Current used template / partial - show name - debug

Hi,

I’m new to Hugo and Hugo Templates.
I’m trying to learn how to make templates in hugo for NetlifyCMS.

I’ve set up NetlifyCMS to create some md files with data in the frontmatter. If I visit the url which I expect my template to load on, I get a different template.

My question:
Is there an easy way to find which template is currently being used? By showing the template name or location in the frontend somehow? How do people generally debug routing / template problems?

I have searched around for info on this topic and this is the nearest I could find:
getting-the-name-of-the-template-or-partial-for-debugging-tracing
Is there any update to this?

This is my current project:
GitHub

This is the md file I’m trying to create a template for:
site/content/gallery/gallery1.md

Many thanks in advance for reading this and for any help you can offer.
All the best,
~ Rik

Perhaps this helps:

And this for background information:

1 Like

Hello Leo,

Thanks very much for the links!

I don’t fully understand how to change the templates to show their locations, so I think I will give that a miss for now. If I can get one template to work, I will be able to follow the docs.

I’ve tried everything I can think of to get a template to show for my gallery content, and nothing works.

My gallery content is in /site/gallery not /site/content/gallery/, could that be the problem?

I can understand how templates work in general by looking at examples, but I can’t find any definitive rules for the way I have my gallery collection.

I’d be so grateful if you could have a peek at my repo above and could let me know where I need to place a template and what I need to call it to get it to load at this url: domain.com/gallery/gallery1/ or domain.com/gallery1 .

Thanks again,
~ Rik

Hi Rik,
I looked at your repo. I’ve no experience with Netlify but I could see your site with hugo server. Good, that you’re working with Tachyons.

If you want to see which template is used just make a temporary remark in all templates like <h1>This is template gallery.html</>. If you want to dedicate a specific template to a page you can use Front Matter. I described this in my post My experiences with Hugo's template lookup order in the different layout variants.

Hope this helps.

Hi Leo,

Thanks again, I’ve worked it out now. Your links were really useful!

All the best,
~ Rik

Like to hear it. You’re welcome. Have fun with Hugo! It’s awesome.