brotkrueml / schema

TYPO3 extension providing an API and view helpers for schema.org markup

Home Page:https://extensions.typo3.org/extension/schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generating markup using loop shows same value

brotkrueml opened this issue · comments

When iterating over breadcrumb items, the values of the items are always the same.

Example:

<f:if condition="{breadcrumbs -> f:count()} > 1">
    <schema:type.breadcrumbList>
        <f:for each="{breadcrumbs}" as="page" iteration="i">
            <schema:type.listItem
                -as="itemListElement"
                name="{page.title}"
                position="{i.cycle}"
            />
        </f:for>
    </schema:type.breadcrumbList>
</f:if>

Produces the following output:

{
   "@type":"BreadcrumbList",
   "itemListElement":[
      {
         "@type":"ListItem",
         "name":"Subsubpage",
         "position":"3"
      },
      {
         "@type":"ListItem",
         "name":"Subsubpage",
         "position":"3"
      },
      {
         "@type":"ListItem",
         "name":"Subsubpage",
         "position":"3"
      }
   ]
}

correct is:

{
   "@type":"BreadcrumbList",
   "itemListElement":[
      {
         "@type":"ListItem",
         "name":"Page",
         "position":"1"
      },
      {
         "@type":"ListItem",
         "name":"Subpage",
         "position":"2"
      },
      {
         "@type":"ListItem",
         "name":"Subsubpage",
         "position":"3"
      }
   ]
}

In version 1.6.0 it works correctly, in 1.7.0 not anymore. The bug was introduced in commit 8efe1df (Introduce TypeFactory).