I have a shortcode that creates a carousel of items from all pages with a specific type in their front matter. Everything works fine except that 20% of the time one of the items is missing. This isn’t much of a problem locally because I can just rebuild and get it back, but in our CI pipeline it is almost always missing.
The shortcode “person_carousel.html” has the range:
{{ range where .Site.Pages "Type" "=" (.Get 0) }}
{{ if gt (len .Content) 0 }} <!-- No idea why, but getting an extra document with no content (also looping over the archetypes maybe?) -->
Code and stuff...
{{ end }} <!-- End of check that there is non-zero Content -->
{{ end }} <!-- End of loop over all documents with the specified type -->
And the pages that should be entries have the front matter:
type = "carousel_entry"
layout = "null"
(the null layout is so that they don’t also be turned into normal pages too)
Then on a particular page where I want the carousel I have:
{{< person_carousel carousel_entry >}}
Shouldn’t the range be completely deterministic? To stress my point - I get different output if I rebuild with no changes whatsoever. It doesn’t appear to follow any logic, sometimes it builds fine 5 times in a row, sometimes fails several times in a row, basically randomly.
Hugo version is “Hugo Static Site Generator v0.32.2 linux/amd64 BuildDate: 2018-01-03T09:54:32Z”
Thanks for any pointers