Metadata for taxonomies

Let’s say I have a ‘brands’ taxonomy.
I would like to add a logo and a link for each brand.
What would be the best way to achieve that?

You could put that meta data in params in brands/nike/_index.md etc.

You’re right. I was trying to avoid having to build individual pages for every brand. But giving it a second though, it’s a good idea. I can create an archetype to speed up the creating of ‘brand’ pages.

Now, it would be amazing if I could automate this process. If hugo finds a brand that doesn’t have a page yet, create the page based on the archetype. Do you know if that is achievable?

The alternative (which I used “pre _index”) is to create some kind of lookup table below /data. Which I guess works better for “lots of taxonomies”. Maybe.

You could combine that with content pages, of course (check page params | default to data).

1 Like

So you are saying make a Brands content page, and have it populate with whatever is in a data file in /data/brands.toml or something?

No.

I say:

  • make content pages for nike and adidas with metadata in params.
  • then in /data add metadata for “the rest”

The use case for the above may be dubious, but it should be easy to create a JSON file with descriptions from a catalogue or something. Then one could supply that with content files for the “important brands”, whatever that is.

2 Likes

Yeah, that sounds like a good strategy.
I also wrote a ruby script to generate all the brand pages, that saved me a lot of time.