How to set index pages of site subsections?


I have a “content” directory that is structured like this:

├── courses
│   ├──
│   ├──
│   └──
├── projects
│   ├──  
│   ├──
│   └──
└── writings

I want that to produce urls like: -> mysite://writings/title-of-paper1/ -> mysite://writings/title-of-paper2/
writings/ -> mysite://writings

and the same in all the other sections. I have written this in config.toml:

post = "/:year/:month/:title/"
projects = "/projects/:title/"
writings = "/writings/:title/"
courses = “/courses/:title/”

it works for all pages, except for the * ones. Even if I write e.g. “url: /writings/” or “url: /writings/index.html” in the frontmatter of doesn’t change anything. In all cases, “hugo server” gives me just a list of all pages in that sections when I go to /writings/

what am I doing wrong?

I think the names of your “index” pages are incorrect and should be “”.

This may help:

1 Like

hi @magikstm,

using does not change anything either. More exactly, if I move writings/ to writings/, remove the url parameter from its frontmatter (and do the same for, etc…)…

what I get when I load localhost:1313/writings/ is just a list, with summaries, of all the OTHER files in the writings directory, except the one renamed to

So here hugo is NOT behaving as in that documentation page. By “here” I mean 2 different linux computers, one with fedora 64bit, hugo v0.18, another with ubuntu 16.04 64 bit, hugo v0.18.1 and in the section not work in 0.18, try 0.17.

Hi @Mikhail,
I believe I have to partially correct what you said: and in the section not work in 0.18, try 0.17”

I have installed hugo 0.17 and tried again. IS recognized and used to generate the index page of a section, meaning that courses/ becomes courses/index.html, instead is treated as normal page by hugo0.17. A file called projects/ was converted to projects/_index/index.html

The problem is that some developers do not believe that the does not work in 0.18. So if you want to have an like 0.17, it is necessary to wait for more bug reports.

for what it’s worth, personally I equally dislike both and, and even giving a full path in the frontmatter like "url: writings/index.html". Personally, I would really prefer to be able to say in the frontmatter something like:

isindex: "true"

to tell hugo “make of this file the /index.html of the folder it is in, period”. That way, I could give all my files whatever unique filenames I wanted, and without having to rewrite the url: keywords if I decide to move folders in other places.

I’m not sure how having a isIndex flag differs from the _index naming convention – conceptually it is the same thing. works fine.

it would just be more convenient in practice, at least for me. But I agree, that’s why I started with “for what it’s worth, personally I…”

No, it does NOT. Right now, I have both 0.17 (as hugo0.17) and 0.18.1(as hugo) installed. Hugo0.17 works as you say (I still have the multilingual site problems I describe in another thread, but let’s do one thing at a time).

Hugo 0.18.1 instead does not recognize the naming convention, as you can see in this output below, just copied from my terminal (Linux Fedora 25, 64 bit, in case it matters, using the statically linked 64bit executable for Linux ). Instead of getting the page titled “Selected Writings” I get a listing of all the pages in the “writings” folder (starting from the one titled “Ebooks”, which is in the file content/writings/

>$ cat content/writings/ 
title: Selected Writings
date: 2016-12-30

this is a test index file of the "writings" section

>$ rm -rf public/ ; hugo >& hugo.0.18log
>$ w3m -dump public/writings/index.html | head -7

>$ hugo version
Hugo Static Site Generator v0.18.1 BuildDate: 2016-12-30T11:02:43+01:00
1 Like

Hey, bep. If it works really well, show me sample code!

The behavior is different between 0.17 and 0.18.

Why did you make a serious change just before the New Year 's holiday?

So people could have something nice to play with in the holidays? Seriously, Hugo 0.17 is still available.

Hugo 0.19 will, if someone wants to spend time implementing it, have a feature where you can turn off rendering of kinds of pages, so you can turn off automatic section rendering, and you will get back your “” hacks behaviour, see

But you should really work on your communication skills. This is FREE software – people are spending their spare time implementing this great piece of software. Show some gratitude and stop whining.

Hugo 0.18 was announced as stable here on this forum one month before release, asking people to try it out and report back any issues. Many did, and none of them reported any “” issues. None. So, we have tested hundreds of Hugo sites manually, and the automatic test coverage in Hugo is excellent – so this is one of the better tested open source releases so far this century.

So, if you have any CONCRETE issues with this release, i.e. not about the before mentioned naming conflict issue where both the section list and a page is rendered to the same “index.html”, then point us to the failing GitHub repo or similar, so we can have a look at it.

I have uploaded to the cloud site that does not display the content of in the section “archive”.
This section generated 0.17 version can be seen here:

I have checked your site, and it works fine for me.

Note that for /archive/ you will have to provide a template for the section (look in the documentation how Hugo looks up templates) – now it defaults to the /_default/list.html which may or may not be what you want. If you modify this template, add {{ .Content }} you will see that the content from is picked up.

I understand that the documentation should be improved in this area.

Thank you. Now I understand. I created the copy of the /layouts/_default/single.html and renamed it to /layouts/_default/section.html. And now I have the in the sections is displayed as static content.

1 Like

If you can help improve the docs about this new feature, please do. Or point to where things are not clear. See also #2827. Thanks

Sorry, my English is very bad, I often write through a translator. In fact, in Hugo 0.18 appeared a new template /layouts/_default/section.html and is now necessary to create a new page in the documentation for it.
It is necessary for it to create the same page as for the single and the list.

The best option is to maintain compatibility with previous versions of Hugo. To do this, need to implement the following algorithm.

if exist render it through single.html (as in previous versions)
if exist render it through section.html
if not exist ( and render it through list.html  (as in previous versions)
if exist both ( and generate an error message or do something else.

If this algorithm was able to realize that would have kept compatibility with previous versions.

@rdwatters, v0.18-DEV was pre-0.18, so you need to update to a new version for this to be relevant.

@moorereason Thanks, brother. Amazing that I didn’t notice that. I feel like a heel.

Ran go get with -u -v and am all good now. Sorry @bep.