HUGO

How to include list pages (_index.md) in taxnonomy template?

I have tags added to both content page files and list page files.

In my taxonomy terms template I copied the following from https://gohugo.io/templates/taxonomy-templates/#example-list-all-site-tags:

 <ul>
    {{ range .Site.Taxonomies.tags }}
            <li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li>
    {{ end }}
</ul>

However, it doesn’t count the list pages. Is there a way to include _index.md files with tags?

1 Like

from my template

{{range site.Taxonomies.tags.Alphabetical}}
<a href={{ .Page.RelPermalink }} title="all pages with “{{.Page.Title}}” ">{{.Page.Title}} {{.Count}}
{{end}}

it is in layouts/tags/terms.html.html

Thanks. But it doesn’t solve my problem.

Actually I noticed the same issue at this theme: https://themes.gohugo.io/hugo-notepadium/

If you look at this file https://github.com/cntrump/hugo-notepadium/blob/master/exampleSite/content/post/_index.md It has a fron matter “tags = [“index”]”

But this tag doen’t appear at the demo site https://themes.gohugo.io//theme/hugo-notepadium/tags/

I’m wondering whether this is possible at all.

my 2cents

tags/index/ is the list over all tags and not the list of pages with tag “index”, this is a side effect ??

tags = [“index”] is nonsense. same as left empty []

Sorry, maybe I’m not clear.

Lets’ say in this folder /content/post/ there are three files:

  • the _index.md is tagged “intro”
  • the other two .md files are also tagged

How to include this _index.md file in the taxnonomy? Currently the taxnomony term template and list template only show the tags of other two .md files, not the _index.md.

I tested it now, same in my site.
Post it as issue / error on https://github.com/gohugoio/hugo/issues

Thanks!

Please consider upvoting the linked issue for increased visibility :slight_smile: