Associate a description with a tag

Is there a way to associate a description with a specific tag? Basically, on the tag list page, I want to show the tag name and tag description.

I saw this post:
https://discourse.gohugo.io/t/add-description-to-taxonomy-tags-term/31388/7

which does it by creating a template for each tag,and adding the description to the template, but I am trying to figure out if there is a central place (config?) I could define the data so I could use a single template, and not create a new template every time I add a tag.

I could probably also use a single template, and then write code to show description based on tag, but again, I was looking for a simpler solution to maintain.

https://gohugo.io/content-management/taxonomies/#add-custom-metadata-to-a-taxonomy-or-term

content directory

content/
├── posts/
│   ├── _index.md
│   └── post-1.md
├── tags/
│   └── tag-a/
│       └── _index.md
└── _index.md

content/tags/tag-a/_index.md

+++
title = 'Tag A'
date = 2024-06-01T09:29:49-07:00
draft = false
+++
This is the description of Tag A.

layouts directory

layouts/
└── _default/
    ├── baseof.html
    ├── home.html
    ├── list.html
    ├── single.html
    ├── taxonomy.html
    └── term.html

layouts/_default/term.html

{{ define "main" }}
  <h1>{{ .Title }}</h1>
  {{ .Content }}
  {{ range .Pages }}
    <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
    {{ with .Content }}
      {{ . }}
    {{ end }}
  {{ end }}
{{ end }}

ok. Just to make sure im reading this right, I need to create a page for each tag.

If you want a description specific to a given tag, then you need to create a page for that tag.

Thank you for confirming.

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