Understanding .Page.Data.Term vs .Page.Title

I’m trying to understand if a behaviour is problematic or as designed and I’m missing something.

Given a registered taxonomy tags if a page has the following FM:

title: That Post
tags: 
- Martial Arts

Then from the term.html template both .Title and .Data.Term will hold Martial Arts as a value. Now if I add a content file for the term at /tags/martial-arts/_index.md somethine like:

# content/tags/martial-arts/_index.md
---
title: Martial Arts 
---

Then the result will differ as .Data.Term will hold martial-arts while .Data.Title will hold the Front Matter’s title Martial Arts or whatever has been used as title.

I would expect .Data.Term to hold the exact same string used to assign the term in the first place on the content files in both cases (with Front Matter or without) and .Title to use the Front Matter’s title when set or defaulting on the term string (.Data.Term) or a “humanized” version of it.

But maybe I’m missing something about the taxonomy api in Hugo.

1 Like

Hugo shows you what you typed and your tags-line had “Martial Arts” in it. Use the slug to refer to your tag and .Data.Term will hold the slug. What’s strange is that Hugo has no problem if you use the title as tag. Maybe though it was not reading in your content/tags/martial-arts/_index.md at all because you did not call the slug…

I would expect the term to (somehow) match the term as defined in the tags slice (as one example). Before we had content page support for terms, people did use the term for titles (and many still do),