Custom list-pages


#1

Not sure if this is helpful to anybody else but here’s a solution for something I expected to be easy but was actually quite hard.

Imagine you have a blog where posts have different tags. You want the hero (header) for the tag list pages to be unique. For example you want to control the hero (heading) for this page:
/en/tags/tag_X/

I could not find a way to access the custom metadata in /content/tags/tag_X/
Otherwise it would have been easy - i could just have set heroTitle: “whatever”

So in stead I had to create headless content and then use if statements in the tags layout to decide when to use it…


#2

I’m not 100% sure I understand the problem, but you can create

 /content/tags/tag_x/_index.md

With all the titles and params you want.


#3

Ha. I must have made some super simple mistake when deciding that approach was not working.
There’s 3 hours of my life I won’t get back.

Thanks bep - this is how I would’ve expected it would work.

Merry Christmas


#4

Welcome to that club. A common gotcha in the above is probably how we normalize taxonomies, so “tag_X” would not work etc. (we lowercase); a good general rule is to take the path from the tag etc. that you see in the browser.