Selecting custom template for content file

Hi, I posted this to SO earlier this week but didn’t get any replies. Respond here or on SO, don’t matter to me :slight_smile: Let me know if you need any additional info!

Running hugo locally. See attached photo of my directory structure.

Hitting localhost:1313/directions-accomodations in Chrome browser. The content file (red box) is loading the single.html template (blue box).

I want it to load a custom template. directions.html ( any of them ). Where do I need to put directions.html , OR, what value do I give the layout front-matter variable in /directions-accomodations/ in order to achieve this?

Repository is available at:

Thank you!

Please update your post with your question, after reading and following the advice at Requesting Help. :slight_smile:

Hey Maiki,

I copied the content from the SO link into this question, I hope that helps. I read through the requesting help guidelines before posting and once again after your comment, is there something I’m missing that I need to add? Let me know, thanks :slight_smile:


I don’t understand this sentence; which page and which layout? With those we can figure this out. :slight_smile:

Regarding help etiquette:

  • I’m building a searchable database of Hugo answers here, hence our copy of the question
  • I always suggest reading the help guidelines, because other folks read these messages :sunglasses:
  • welcome to the forum, thank you for reading the docs


Okay! I’m trying to load /site/content/Directions-Accomodations/ (circled by a red box in the attached screenshot). That’s the page. When I hit localhost:1313/directions-accomodations it loads that markdown file.

BUT, that markdown file CURRENTLY LOADS /site/themes/hello-friend-ng/layouts/_default/single.html (circled by a blue box in the attached screenshot).

That IS NOT the template file I want to load. I set the frontmatter ‘layout’ value to ‘/directions.html’ because that’s the file I want to use for the template.

I know there are many many ‘directions.html’ files in my project, but that’s because I was trying to see where I needed to add it. They’re all the same and therefore It doesn’t matter which one we load I’m just confused why setting the ‘layout’ frontmatter doesn’t seem to change the template being loaded. Once I find out how to set the layout frontmatter or where to put the template files, I can remove the additional directions.html files.

Please let me know if that clears things up. Thank you for your help!

Maybe someone can assist ya; I can’t work from a screenshot, and the repo is private or gone.

A couple of suggestions, though.

Keep all your “pages” in content/pages. You could have a page at /content/pages/ with the following front matter:

title: "Directions & Stuff"
layout: directions
url: "/directions-accomodations"

And your layout at layouts/_default/directions.html, it would output what you want. And all your single page content can go in that one pages directory, and you can customize each with front matter.

That sounds… aggravating. I’d avoid the practice, it will definitely mess you up trying to debug it. :grimacing: