Newbie: setting up blog with "pages", sections etc

More newbie questions. I want to be able organize my pages like this

example.com/en/              - show english 'welcome' page (no index)
example.com/en/about/        - show about page
example.com/en/published/    - references
example.com/se/              - show swedish 'welcome' page (no index)
example.com/se/om/           - show about page
example.com/blog/2017/06/10/ex1
example.com/blog/2017/06/11/ex2

But I don’t know how to organize the pages and configure Hugo. I would appreciate if someone could give me some hints of how to do this. I’ve tried creating something like this

content +
        |
        +-- en +
        |      |
        |      +- index.md
        |      +- about.md
        |      +- published.md
        |
        +-- se +
        |      |
        |      +- index.md
        |      +- om.md
        |
        +-blog +
               |
               + 2017 +
                      |
                      + 06 +
                           |
                           + ex1.md
                           + ex2.md

and then in the preferences

[permalinks]
  blog = "/blog/:year/:month/:day/:slug/"

which seem to work for the blog entries. But on the front page ‘example.com’ I also get items from the ‘en’ and ‘se’ folders.

How do I tell Hugo not to add items from ‘en’ and ‘se’ to the general entry index?

How do I tell Hugo not to create indexes for ‘en’ and ‘se’, but instead use the content of the index.md files?

I’m sorry if this is covered in the docs, I tried figure out how to do it reading the docs but I’ve probably missed something.

What do you mean by the “general entry index?” Are you talking about your homepage? If you are looking to just get pages from blog/, you can set your range as follows:

{{range where .Site.Pages "Section" "blog"}}
Your code here....
{{end}}

Also, you should be able to just create posts inside of blog and then set the permalink configuration (as you show above) and get the desired URL output without having to make a bunch of crazy subfolders…

https://hugodocs.info/content-management/urls/

If I understand correctly, use _index.md for adding content and front matter to list pages (i.e., the pages that act as the index.html/home of a section). See here:

https://hugodocs.info/templates/lists/

Yep, I was referring to what you get when visiting example.com. Thanks, this info will keep me busy for a while

:smiley: I like to keep a few subfolder to keep my sanity but right now I’m pushing things to see if I can get Hugo to handle things the way I want (if it can do a worst case scenario then I’m happy)

1 Like