Hey guys. I’m a little confused about how to get a custom page for my section. I have a section called /content/services
which has an _index.md
and 2 other files. Instead of rendering _index.md
it’s serving up the /<theme>/layouts/_default/list.html
template, which lists the 2 files in /content/services
. How can I get /content/services/_index.md
to render when browsing http://localhost:1313/services/
? I also tried creating /layouts/services/index.html
to no avail.
Using Hugo v0.24.1.
That should render, but you can make a template specifically for that section
layouts/services/list.html
Hugo will look for identical layouts in your project directory before it goes to the themes directory in terms of the lookup order…so @budparr 's solution will work as well.
I would recommend creating the same file but up a couple levels up at yourproject/layouts/_default/list.html
.
You can then tweak the templating as needed. To get the content from the _index.md
mentioned, you can add the {{ .Content }}
variable.
If I create /myproject/layouts/_default/list.html
then my theme’s layouts/index.html
is no longer respected for some reason. The content from /content/services/_index.md
will show though.
You’re not getting any errors? Doesn’t sound related. You have a repo you can post?