It seems like the default behaviour in Hugo is that the section of a markdown file defines the type of the file. Also, in the documentation it is directly stated that a type should be singular, but many examples of section in the same documentation are plural. This seems to be at odd with with the requirement that types are singular.
So my question is “if I have a file in contents/notes/” is its type notes or is its type note, and where should where should I put templates for notes, layout/notes/ or layout/note?
I’m not sure what the doc says (please file a bug on the documentation), but I mix and match these myself (and I’m from Norway, so the English plural rules doesn’t apply).
So /content/notes will become SECTION notes. If no other TYPE is defined in front matter, it will also be of TYPE notes.
And it is that value (the name of the folder) that is used for all purposes – selecting templates etc.
I have personally found this to be not quite true. I have found that Hugo gets very weird if you don’t use singular when naming your folders. I had 4 content folders which I wanted to use : about, industries, features, and modules. I set up my menu in config.toml as such:
I also set up a section folder in layouts that had html files of the same name. When I ran hugo server only about and features would be rendered. industries and modules would not be rendered. I could only fix it by renaming all the html and folders for industries and modules into industry and module and changing the menu accordingly.
Yes, this can be a little confusing.
I find it helpful to remember there are a few things going on here:
are you thinking “top-down” or “bottom-up” (i.e. is your site “sections of content” or “content in sections”…)? I could see how thinking in the “top-down” way might add some confusion.
Hugo does “want” a certain directory structure (as a default). This can change (hello, Hugo Modules )
Hugo does have some reserved words, which, for better or worse, have a certain meaning and are not mutually exclusive (all “sections” are “lists”, not all “list” are “sections”)
At least for my really own project, I wish to build a personal site, containing:
posts: content mostly organized around chronology
pages/notes: content essentially thematic, ordered alphabetically (Nikola blog engine call this stories)
photos: some photos I wish to share publically, grouping them.
Reading your explanation, I think it is a top-down decomposition.
And then come complexity, mostly due to flexibility of Hugo: sometimes, I go outdoor for a hiking trip. How to write about this? Is it a post? Is it a story describing the hiking track? And what about photo: should I create a gallery for each trip or should I embed the photos in a gallery inside the story concerning the trip (as Page Resource). But wait, what are Hiking trips: are they sub-category of stories or a dedicated type of content (in a given root-section)?
And then come themes, with their own vision of the structure… not so easy to deal with a so powerful tool like Hugo.
Haha, yes! What you are describing is the definition of a hard design challenge – the only answer is to answer it .
There is no “correct” answer. Some solutions might work better for you to edit, some might be “simpler” when it comes to templates, oh! and don’t even start thinking about tags!, etc. etc.
Something that might help:
think about how you want to edit your site
think about the URLs (since Hugo is a little opinionated in this regard (i.e. it will by default have URLs which relates to your content directory structure), if you have any aesthetic opinions on URLs, you may need to adopt a particular content directory structure)
biggest thing: jump in. it won’t be perfect at first, but as you use it your will learn what you need to teach yourself