Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating markup using loop shows same value #52

Closed
brotkrueml opened this issue May 26, 2020 · 1 comment
Closed

Generating markup using loop shows same value #52

brotkrueml opened this issue May 26, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@brotkrueml
Copy link
Owner

brotkrueml commented May 26, 2020

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"
      }
   ]
}
@brotkrueml brotkrueml self-assigned this May 26, 2020
@brotkrueml brotkrueml added the bug Something isn't working label May 26, 2020
@brotkrueml brotkrueml changed the title Using iteration.cycle for markup shows same value Generating markup using loop shows same value May 26, 2020
@brotkrueml
Copy link
Owner Author

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

brotkrueml added a commit that referenced this issue May 26, 2020
The concrete view helper is instantiated on the first iteration. On consecutive iterations
the same model is used as reference, so the last iteration overrides all the others before.

Resolves: #52
brotkrueml added a commit that referenced this issue May 26, 2020
brotkrueml added a commit that referenced this issue May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant