Where to place templates for a single page?


I just discovered Hugo and wanted to try to port my existing site (in harp.js), to give it a try as it looks like a very, very good project.

I failed at understanding why my layout is not applied to a page. My whole site will be made of static pages (static in the sense that this is not a blog with posts).

When creating a new site with hugo new I ended up with a layouts directory. My expectation was that the server starting with no theme would go there looking for _default\single.html. This is also what the docs say when giving the list of places hugo is looking at when looking for a template to apply.

I also read https://discuss.gohugo.io/t/creating-a-minimal-working-template/135 - the contents of this very helpful post agree with the docs :slight_smile:

I placed my firstfile.md in contents, started the server with hugo server --verbose --uglyURLs --ignoreCache and accessed it at It is rendered HTML, but a bare one which did not take into account the contents of single.html (I reused the one from https://discuss.gohugo.io/t/creating-a-minimal-working-template/135).

So can I place my files in content, have them rendered as and also have them go though the layout described in … ? (layouts\_default\single.html does not seem to work for me).

Thank you for any help!relaxed:

Hey & welcome to Hugo. Can you give a directory listing of your site and the output of your hugo command?

Hello Michael,

After spending the night on various tests I finally managed to get it to work. I am not sure anymore what I did, I think it must have been a mistake of mine somewhere which I tracked down via the dev tools. In any case everything works fine and according to the docs.

I will delete this question once I find out how :slight_smile:

I would suggest you don’t delete the question, because it is helpful to leave record of where you had trouble understanding the docs. Because if enough people have trouble with the same issues, that prompts to revise those passages in the docs.

Best of luck with your site.