Closed cale-inspired closed 8 years ago
With regard to the sections, the only functionality that the theme provides is providing a different name to the post section, not creating subsections the way you are trying to do. If you want sections, you can follow the docs here to create something like http://example.com/post/health/health-post1. I can't remember if Hugo provides indexing for sections or not when visiting a url like http://example.com/post/health.
If you want to provide sections using the partials that restrict posts to categories like health vs. games, Hugo might have some filtering capability. Alternatively, you could extend https://github.com/chipsenkbeil/grid-side/blob/master/layouts/partials/post/list.html#L29 to support filtering the pages that are listed.
With regard to the sections, the only functionality that the theme provides is providing a different name to the post section, not creating subsections the way you are trying to do.
So is this a matter of the theme or Hugo itself? If it's just about the theme, then there should be a way to include that functionality manually, right? I definitely need indexing for the sections.
Well, you can take a look at my site here. It's for https://chipsenkbeil.com (not senkbeil.org) and uses the post layout for multiple sections (note and post). Those are separate sections that can be accessed via https://chipsenkbeil.com/post/ and https://chipsenkbeil.com/note/. I don't have a section dedicated to retrieving all content, though. That would be layouts and content you would probably need to add on top of the theme.
Perfect, thank you! That's exactly what I want to do. I will look into it and try to implement it in my site. BTW: I asked on the gohugo forums for the latter issue, and just got a reply that it was possible to list all articles with .Site.Pages. (see https://discuss.gohugo.io/t/list-page-for-all-content-of-all-sections/3832/2?u=inspiritana) Right now I am still tweaking the homepage design, afterwards I'll try to achieve that section stuff (and will post in here if/how I managed to do it). Cheers!
Wow, it was in fact much easier than I thought:
{{ range .Paginator.Pages }}
to
{{ range .Site.Pages }}
Edit: In order to display only blog sections, I use:
{{ range where .Site.Pages "Section" != "not_wanted_section" }}
OR:
`{{ range .Site.Pages.ByPublishDate.Reverse }}
{{ if or (eq .Section "wanted_section1") (eq .Section "wanted_section2")}}
{{end}}
{{ end }}`
That's it! Thanks for your help, Chip!
Great! I'll close this issue. If you still need to discuss something regarding this, feel free to open it back up. If there is some code that needs to be amended, you are more than welcome to create another PR.
Hey there, first of all: I am still very new to Hugo, so excuse me if the answer to my question should be obvious...
What I am trying to do: I would like to have several blog sections, sorted by content category (e.g. health, games, cars). All of those sections should have the same layout but (of course) different articles. The structure is supposed to be: site.com/health/health-post1/ site.com/games/games-post1/ etc. If this is achieved, I would like to go a step further and have site.com/all/ as well, where all posts of the listed sections will be shown. (Is this possible?)
What I have tried so far:
My question: How can I do the same I have achieved so far, but with unique content for each section?
I have read the hugo docs on sections but they didn't help me... Maybe I still get something completely wrong about how sections work.
THX!