Looking for advice on content folder structure

Hi all. I’m just starting with Hugo and trying to build a site with it. There will be two sections: blog and projects. Right now my content folder looks like this

content/
├─ blog/
│   ├─ post_1
│   │   ├─ picture1-1.png
|   |   └─ index.md
│   ├─ post_2
│   │   ├─ picture2-1.png
|   |   └─ index.md
│   ├─ post_3
|   |   └─ index.md
|   └── index.md
└─ projects/
    ├─ project_1/
    │   ├── picture1-1.png
    |   └── index.md
    ├── project_2/
    |   └── index.md
    ├── project_3/
    │   ├── picture3-1.png
    │   ├── picture3-2.png
    |   └── index.md
    └── _index.md

Each project lives in its own sub-directory/page bundle with the projects section being a page bundle as well.

But with blog I’m afraid my current layout is not optimal. The problem is that number of posts is quite hight (~500 post) and will be increasing in the future. Having all posts in a single directory seems not a best solution because it is difficult to navigate, update and maintain such amount of entries. I’m thinking about splitting posts in sub-folders by year. But don’t know what is the best way to achieve it. Should I make each year folder a page bundle or there is a better way to do it? I do not want to include that year sub-folder in the resulting page URL string, as each blog post will have a date in the URL anyway.

Sorry if my explanations are not very clear.

content structure

content/
├── blog/
│   ├── 2022/             <-- no _index.md in this directory!
│   │   ├── post-1/
│   │   │   ├── a.jpg
│   │   │   └── index.md
│   │   └── post-2/
│   │       ├── b.jpg
│   │       └── index.md
│   ├── 2023/             <-- no _index.md in this directory!
│   │   ├── post-3/
│   │   │   ├── c.jpg
│   │   │   └── index.md
│   │   └── post-4/
│   │       ├── d.jpg
│   │       └── index.md
│   └── _index.md
└── _index.md

site configuration

[permalinks]
blog = '/:section/:slug'

rendered

public/
├── blog/
│   ├── post-1/
│   │   ├── a.jpg
│   │   └── index.html
│   ├── post-2/
│   │   ├── b.jpg
│   │   └── index.html
│   ├── post-3/
│   │   ├── c.jpg
│   │   └── index.html
│   ├── post-4/
│   │   ├── d.jpg
│   │   └── index.html
│   └── index.html
└── index.html

You can also use date tokens in the permalink configuration. That way you don’t have to include the date in the filename or slug.

1 Like

Thanks a lot, @jmooring! This is very helpful and seems I still need to learn more about page bundles.

And thanks for the hint about date tokens!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.