# Selecting custom template for content file

**URL:** <https://discourse.gohugo.io/t/selecting-custom-template-for-content-file/23918>\
**Category:** support\
**Created:** [March 10, 2020, 10:59pm UTC](https://discourse.gohugo.io/t/selecting-custom-template-for-content-file/23918 "2020-03-10T22:59:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris-schertenlieb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/chris-schertenlieb/32/10767_2.png) [@chris-schertenlieb](https://discourse.gohugo.io/u/chris-schertenlieb)\
**Post date:** [March 10, 2020, 10:59pm UTC](https://discourse.gohugo.io/t/selecting-custom-template-for-content-file/23918/1 "2020-03-10T22:59:27Z")

</div>

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 🙂 Let me know if you need any additional info!

> <https://stackoverflow.com/questions/60591826/defining-custom-template-for-content-file-in-local-hugo-project>

> 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/index.md` in order to achieve this?
> 
> ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/3/32f59405539ed29c2078ca9ca054f529e7b679c6.png)

Repository is available at: [https://github.com/chris-schertenlieb/schertenlieb-wedding](https://github.com/chris-schertenlieb/schertenlieb-wedding)

Thank you!

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [March 11, 2020, 5:01am UTC](https://discourse.gohugo.io/t/selecting-custom-template-for-content-file/23918/2 "2020-03-11T05:01:19Z")

</div>

Please update your post with your question, after reading and following the advice at [Requesting Help](https://discourse.gohugo.io/t/requesting-help/9132). 🙂

---

<div class="post-metadata">

**Author:** ![chris-schertenlieb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/chris-schertenlieb/32/10767_2.png) [@chris-schertenlieb](https://discourse.gohugo.io/u/chris-schertenlieb)\
**Post date:** [March 11, 2020, 11:48am UTC](https://discourse.gohugo.io/t/selecting-custom-template-for-content-file/23918/3 "2020-03-11T11:48:14Z")

</div>

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 🙂

Chris

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [March 11, 2020, 5:46pm UTC](https://discourse.gohugo.io/t/selecting-custom-template-for-content-file/23918/4 "2020-03-11T17:46:04Z")

</div>

> [@chris-schertenlieb](#):
>
> I want it to load a custom template. `directions.html` ( _any of them_ ).

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

* * *

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 🕶
- welcome to the forum, thank you for reading the docs

---

<div class="post-metadata">

**Author:** ![chris-schertenlieb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/chris-schertenlieb/32/10767_2.png) [@chris-schertenlieb](https://discourse.gohugo.io/u/chris-schertenlieb)\
**Post date:** [March 11, 2020, 6:01pm UTC](https://discourse.gohugo.io/t/selecting-custom-template-for-content-file/23918/5 "2020-03-11T18:01:40Z")

</div>

Maiki,

Okay! I’m trying to load /site/content/Directions-Accomodations/index.md (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!

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [March 11, 2020, 6:24pm UTC](https://discourse.gohugo.io/t/selecting-custom-template-for-content-file/23918/6 "2020-03-11T18:24:56Z")

</div>

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/directions-accomodations.md` with the following front matter:

```auto
---
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.

> [@chris-schertenlieb](#):
>
> 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.

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