Trying to range over all terms in a taxonomy with a template in layouts/<taxonomy>/list.html.
.Data.Terms gives me an empty slice/array
.Pages gives me the correct list of terms
Two questions:
Why doesn’t .Data.Terms work here?
How do I get the number of entries for each term? The documentation mentions .Count(term) but how would I use that in range .Pages? Something like .Count(term) always gives me an error because of an unexpected “(” in operand.
Edit: Figured out the last one: The parentheses are misleading, one should simply put the term after Count. But the result of site.Taxonomies.<taxonomie>.Count <term> is wrong
This part of the documentation is preciously short of examples.
layouts/<taxonomy>/terms.html is at position 6 in the taxonomy list template lookup hierarchy, whereas layouts/<taxonomy>/list.html is at position 8. Perhaps that makes a difference, leading to .Data.Terms working in the first, but not in the second. But should it?
…the layouts/tags/list.html template is used to render both taxonomy and term pages.
I am unable to reproduce the problem you’re experiencing with “an empty slice”
git clone --single-branch -b hugo-forum-topic-45919 https://github.com/jmooring/hugo-testing hugo-forum-topic-45919
cd hugo-forum-topic-45919
hugo server