gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
73.92k stars 7.41k forks source link

lessons learned trying to get tag index pages working. need doc update? #6688

Closed Dieterbe closed 4 years ago

Dieterbe commented 4 years ago

Hello, I'm not sure where the issue lies. perhaps https://gohugo.io/templates/taxonomy-templates/ or https://gohugo.io/templates/taxonomy-templates/#taxonomy-list-template or elsewhere. but I spent a significant enough amount of time trying to get my tag listing working, so I think i should share. hopefully it helps others, and perhaps documentation can be improved.

I noticed that as of a recent upgrade, my tag listing pages simply started listing all my pages, rather than only the pages that have that tag. I use a theme based on https://github.com/jaden/twentyfourteen by @jaden , which recently received a patch to accommodate https://github.com/gohugoio/hugoThemes/issues/682 (https://github.com/jaden/twentyfourteen/commit/89e9097208629a4b3f8c4318c5bf64eff73c7f71). perhaps this is related to the issue as well.

According to the hugo docs, the tag listing pages (/tags/<tagname>) should "just work". the docs don't clearly state (though seem to imply) that the filtering is done by hugo, and not in the template. at least the docs interchangeably talk about listing pages whether they are unfiltered lists or regular lists (e.g. on https://gohugo.io/templates/taxonomy-templates/#taxonomy-list-templates)

also from https://gohugo.io/templates/lists/ i couldn't really figure out where the filtering is done. https://gohugo.io/templates/lists/#taxonomy-template shows a range over .Pages which I think is deprecated now.

Since I couldn't find resources on this topic, I ended up trying some other themes to see which work. which led me to "simple-style" which has it working. looking at its layouts/_default/list.html file I saw that when I use {{ range .Paginator.Pages -}}, not {{ range where site.RegularPages "Type" "in" site.Params.mainSections }} it seems to work.

that said, i don't even use pagination, so i'm not sure if this is the proper solution...

bep commented 4 years ago

Please post documentation related issues here: https://github.com/gohugoio/hugoDocs/issues

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.