I’m looking for a good tutorial or explanation how you can create relatively clean Layouts for Content with 3 or 4 subfolders in Hugo. Most tutorials I found are mostly very basic and end with section 1 or section 2 unfortunately.
I don’t want 4 “Sub-URLs”, but I would like to order my content with at least 3, maybe 4 subfolders in the /Content folder.
First subfolder is for /posts, second for /authors (Author1, Author2…), and subfolder 3 & 4 for the topics and subtopics, so like this
I have the _index.md files included in every folder, but for better readability I left these out in this example. “index.html” is of course “_index.md” here. Sorry for the confusion, you can ignore it.
The /posts folder is only FOR ME to organize my content and should not be relevant for the page at all. I already tried out Permalinks. It’s working, but I can’t get rid of /posts without breaking the page structure. /posts keeps rendering, even if I include this into the Frontmatter:
Is there a way how I can completely ignore the /posts section and make the Author directories the first subdirectory without deleting the /posts folder?
I would like to create slightly different Headers for every author (different Name and Image) + make different Head Layouts for e.G. Table Pages, Link-Lists and so on because I use different CSS files for the sites.
That’s why I was asking for a more detailed Layouts tutorial because it’s a bit more complicated what I’m trying to do. As a beginner this can be very overwhelming
I followed your instruction and it worked. The /posts section is gone now. Section 1 is /Section1 .
But now Section-1 can’t access their child pages anymore because Hugo still builds the lower-sections with the old URL /posts/section-1/section-1-1 .
No matter how I changed the Config Permalinks, it’s seemingly only affecting /posts and section-1.
So I changed the URLs manually to “/section-1/section-1-1” etc. in the Frontmatter.
Unfortunately Section-1 still can’t list their child pages.
Is there a workaround, how I can get access to the child pages again, or am I doing sth. wrong?
It seems like the sub sections are still officially stored under /posts/section-1 , although I edited their URL in the Frontmatter.
This is extremely helpful. Thanks for the big effort!
I still don’t exactly know what was the problem. Everything is indeed working as expected. Also, if I adapt it to my Layout - It works
Only the following confuses me:
I created a new Hugo Site, copied everything from your site into my project and I still got /posts on every page. Same as on my regular website.
I created another new Hugo Site. Now I DELETED EVERYTHING inside and pasted your archetypes, content, layouts, resources, static folder and the hugo.toml + .hugo_build.lock files into this new Hugo Site and it worked like a charm.
I’m relatively sure, that I made no mistake in 1, so I’m wondering what could be the reason?
I use the newest Hugo extended version for Linux and Hugo automatically creates me a standalone “assets” and a “data” folder, which wasn’t in your project. Can this be the reason?