Term pages get .Date from first page in list in 0.123.8

With 0.123.8 (perhaps since 0.123.0, but I didn’t test it), term pages get a .Date from its first page. I don’t think this is correct, because it doesn’t make sense to assign a date to a term page.

You can reproduce it with any site:

  1. Create/edit layouts/term/list.html
  2. Run hugo server and navigate to a term page, like /tags/red
  3. In layouts/term/list.html, put {{ warnf "%s" .Date }} in a line that is executed
  4. See the console. Hugo will log the date from the first page in that term list

Testing as far back as 0.54.0, with the default front matter configuration, the value returned by .Date on a list page will be the front matter date field of the section page (_index.md), falling back to the most recent date of descendant content. But keep in mind the fallback values defined by the front matter configuration referenced above.

So, unless I’m missing something, this isn’t anything new.

Here is the site I used for testing:

git clone --single-branch -b hugo-forum-topic-48828 https://github.com/jmooring/hugo-testing hugo-forum-topic-48828
cd hugo-forum-topic-48828
hugo server

And to me the behavior makes sense.

That’s strange… I discovered it making a diff between public dir generated with 0.121.2 and with 0.123.8. In 0.121.2 the date didn’t get rendered… but probably it has to do with another thing specific to my site, then. Anyway, I should have better tested it. Thank you!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.