Hi all!
I have about 250 Pages.
{{ range (where .Data.Pages "Section" "article").ByDate.Reverse }}
page
{{ end }}
This prints 250 times ‘page’. OK
Now if I use any Scratch function it only get 22 times printed:
{{ range (where .Data.Pages "Section" "article").ByDate.Reverse }}
{{ $.Scratch.Add .Params.category 1 }}
page
{{ end }}
What’s going on here? Why?
Background of this: I added a category param to every page. Now on the startpage I want to show only 2 pages from every category sorted by date. ended up with this:
{{ range (where .Data.Pages "Section" "article").ByDate.Reverse }}
{{ if lt ($.Scratch.Get .Params.category) 2 }}
{{ $.Scratch.Add .Params.category 1 }}
<div class="column">
{{ .Render "list-item" }}
</div>
{{end}}
{{ end }}
It should and do work, but the loop does not iterate over all pages, but breaks after ~ 22 pages … so some categories are not showed oder only one page instead of two