Is it possible to create a unique custom template for only 1 specific tag named "new winners"

Within my blog.md file, I have tags listed within object. But I’m having hard time figuring out how to check if “new winners” exist within the tags and if so, to use a custom list template for that specific tag.

title: ‘Todays New Winners’
date: Wed, 20 Aug 2020 18:00:53 +0000
draft: false
tags: [‘New Winners’, ‘First’]

don’t shoot you in the back :wink:

layout = newwinner

in frontmatter can do the trick.

create the new list template newwinner.html and put it in layouts/<section>/

section stands for your section name …

@ju52

Thank you so much for your response! haha yes, I was thinking something similar after spending 2 days trying to figure this out. Yes, this sounds like the more painless way. (to create a template within layouts)

My plan was to create a new taxonomy in the admin/config and instead of having newwinner as a tag, I can add it as a new taxonomy in my blog.md.

title: ‘Todays New Winners’
date: Wed, 20 Aug 2020 18:00:53 +0000
draft: false
tags: [‘First’]
winners: "new winners"

If I kept it as a tag, I’m still confused how I could call for the template within layouts/blog/newwinner.html, if it was a tag i.e. tags: [‘New Winners’, ‘First’]. How do I actually get that template to work?

I’m assuming you’re suggesting this within my frontmatter? Will everything that is tag “new winner” have a new list page?

title: ‘Todays New Winners’
date: Wed, 20 Aug 2020 18:00:53 +0000
draft: false
tags: [‘First’]
winners: "new winners"
layout: newwinner

Thanks for your help

hi,

newwinner.html is a single page.

Hugo will create the taxonomy directory /winners , you can create a special list template in layouts/winners

don’t forget to activate winners as taxonomy in config.

Compare it with my sample site https://github.com/gj52/HugoSample

I have special templates for tags and series.

1 Like