Are sections supposed to be left out of taxonomies?

I assigned a value for a configured taxonomy in a section page’s front matter (e.g. tags = ["foo"]), but I don’t see that section page listed as a term on the taxonomy page (e.g. tags/foo).

Mmh dunno if I understand your first sentence. But:

Having:

hugo.toml:

[taxonomies]
tag = ['tags']

/content/mysection/_index.md

+++
title = "My Section"
tags = ["foo"]
+++

I get a file tags/foo/index.html that links to /mysection as expected.

…can you give more details about your setup

I have configured in hugo.toml:

[taxonomies]
tag = "tags"

I have:

tags = ["foo"]

in:

  • content/bar/_index.md
  • content/bar/a.md
  • content/bar/b.md

On tags/foo/index.html, a.md and b.md are listed, but _index.md is not.

Guess you left out some details from your content files :face_with_peeking_eye:

The page is rendered: check your generated html output file for the tag.

Guess you have no title and no text in your index, but at least one of that in your pages.

Try adding a title attribute or some text

Background

  • a term page is a list page
  • so the page is rendered according to the lookup orders defind for terms and list pages

With a standard hugo new site and new theme it will use `/themes/NAME/layouts/_default/list.html

Which for all pages with the tag renders.

<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a><h2>
{{ .Summary }}

If you have neither title nor text this results in

<h2><a href="/bar"></a><h2>

Which just won’t show up visualy in your browser

1 Like

I checked the HTML, and it’s not appearing at all. The section does have a title, for what it’s worth.

I tried creating a new site with a simple list layout, and I can see a section being included in RegularPages for a term page, so it does seem it’s supposed to work. I have no idea why it’s not included when using my theme, though.

This is the (simplified) template for term pages:

{{ $page := . }}
{{ $pages := $page.RegularPages }}
{{ if and (not $pages) (in (slice "taxonomy" "term") $page.Kind) }}
    {{ $pages = $page.Pages }}
{{ end }}
{{ with $pages }}
    {{ $ordered := slice }}

    {{ range ($pages.GroupBy "Weight").Reverse }}
        {{ range (sort (.Pages.GroupBy "PublishDate") "Key").Reverse }}
            {{ range .Pages.ByTitle }}
                {{ $ordered = $ordered | append . }}
            {{ end }}
        {{ end }}
    {{ end }}

    {{ $pager := $page.Paginate $ordered }}

    {{ range $pager.Pages }}
        {{ partial "paige/page.html" . }}
    {{ end }}
{{ end }}

So OOTB that works…you have your theme , content pages, and config

Let me cite:

Too much for me digging in further without the context