Content folder organization

I am mainly just curious if anyone has tips or links to blog posts on content folder structures in hugo. Specifically pertaining to post/blog archive structures for medium to high volume content (say up to a post a day) and methods of automating that workflow within Hugo.

Google just isn’t the tool it used to be. And I think I just need to stretch my mind a little and get some feedback from others more experience than me with hugo and static site file structures. So I apologize in advance if I get long winded. A lot of stuff is bouncing around in my head and I’m thinking as much philosophy as what I need to learn to do with hugo.

I am looking to go with a tumblr post type structure embedded in a portfolio website. Over time, I’ll port my instagram and other social media content back over the the site as β€œposts”. So content types would be articles, photo, quotes/excerpts and links.

So I’m thinking the overall flow for blog content needs to be something like:

.
β”œβ”€β”€ about
β”œβ”€β”€ posts
β”‚   └── 2022
β”‚       └── 01-Jan
β”‚           β”œβ”€β”€ 220107_copy_my-first-post
β”‚           β”œβ”€β”€ 220108_quote_steinbeck
β”‚           β”œβ”€β”€ 220109_photo_nyt-a1
β”‚           β”œβ”€β”€ 220110_link_vii-ashley-gilbertson
β”‚           └── YYMMDD_type_post-title-here
β”œβ”€β”€ prints
└── projects

11 directories, 0 files

Since articles and photo sound like they’ll have to have access to page resources, they’ll need to be folders. Others could just be md files.

Or is there a way better way to keep a large volume of post content organized? or even better way to do this?

Typically I like to have content for daily updates under

.
β”œβ”€β”€ about
β”œβ”€β”€ posts
β”‚   └── 2022
β”‚       └── 01
β”‚            └── 01
β”‚                └── index.md

Basically :year/:month/:day but you can also skip this organization and simply configure a Section’s permalinks to be outputted using the above structure, without actually organizing the content like so.

This is my preference because I have found that using this directory structure makes it is much easier to find anything I may need -like for example a blog post from May the 2nd 2011- without having to use file search.

Perhaps others can share their content organization methods.

1 Like

Comments…

1) For the month directory, just use the 01 instead of 01-Jan. If for some reason you need the month directory to include a string abbreviation, use lowercase. Uppercase letters in directory and filenames can come back to bite you later.

2) If you want to include a date in your filename, use the yyyy-mm-dd format. In this example I have two content pages: a regular page and a leaf bundle.

content/
└── post/
    β”œβ”€β”€ 2022-01-19-my-second-post/
    β”‚   └── index.md
    └── 2022-01-19-my-first-post.md

Then, in your site configuration:

[frontmatter]
date = [':filename', ':default']

With this configuration:

  • The .Date value is extracted from the filename. If the filename doesn’t include a date stamp, the .Date value will be extracted from front matter using the default preference.
  • The .Slug value will be extracted from the filename (e.g., my-first-post).

Reference:
https://gohugo.io/getting-started/configuration/#configure-dates

2 Likes

That makes a lot of sense! I will take that into consideration.