Custom term metadata overwritten by page front matter term

I am trying to define a custom taxonomy “topics” and for each term within the taxonomy (each “topic”) define an image to use to render the link to that topic page. The structure I have created to define this custom metadata is as follows, in accordance to this documentation: Taxonomies | Hugo


I have defined this taxonomy in my hugo.toml:

  category = 'categories'
  tag = 'tags'
  topic = 'topics'

And added topics to some of my posts’ front matter as follows:

title = 'Test Post 1'
type = 'post'
tags = ['featured']
categories = ['category_1']
topics = ['topic_1', 'topic_2']

However, when I attempt to use the metadata I defined, it seems like the actual topics defined in my posts are overwriting or somehow conflicting with the topics with actual metadata, as when I output the list of taxonomies for my site, the actual topics taxonomy is empty and the topics are listed under an empty key in the taxonomy map (instead of under the “topics” key)

{{range $key,$val := .Site.Taxonomies}} <br/>{{$key}}  = {{$val}} {{end}}


= map[topic_1:[WeightedPage(0,"Test Post 1")] topic_2:[WeightedPage(0,"Test Post 1")]]
categories = map[category_1:[WeightedPage(0,"Test Post 1")]]
tags = map[featured:[WeightedPage(0,"Test Post 1")]]
topics = map[]

I am unsure where I went wrong in defining my custom term metatada, if someone could indicate the appropriate structure for defining such metadata it would be very much appreciated, thanks.

Take this for a spin:

git clone --single-branch -b hugo-forum-topic-46887 hugo-forum-topic-46887
cd hugo-forum-topic-46887
hugo server

Files of interest:

  • content/topics/topic_1/
  • content/topics/topic_2/
  • layouts/_default/home.html

Thank you very much! Extremely helpful :smile:

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