Hello,
sorry for the ignorant question, but I haven’t managed to find anything after hours of searching and three failed starts:
I would like to structure my site so the front page (and various other pages) are static (think “open source project site”) and to have two blogs, a product blog and a community blog, say.
So far, I haven’t found any way to make my front page be static. All the themes only seem to want to display a list of posts. How can I do what I want? Is it completely up to the theme, and thus I should pick a theme that supports my use case, or can I structure my content a certain way to achieve this?
You can have a static home page and have two blog sections if you want. I don’t know if there is an existing theme that covers that use case, so you might need to design the layout yourself.
The index.html is the easiest to deal with. Check out how the repo @kaushalmodi linked to does it.
For having two different blogs, you just have to think on how you want to structure your site. Are you planning on using subdomains or just different sections on your main site? For example, are you planning on:
productblog.example.com and communityblog.example.com
or
example.com/productblog/ and example.com/communityblog/
Both are straightforward, but the latter can be done all in one hugo site, while you’d have to create multiple hugo sites for different subdomains.
By “static page” I basically mean “a page that isn’t a part of a collection, like a blog post would be, but something like the /product/” page on a site.
I would like to structure the blogs as subdirectories on my website, not on different subdomains. I’m realizing, after @sethm’s response, that the page/post list layout is mainly dictated by the theme, so I’m looking into creating my new theme, and @kaushalmodi’s example is a good starting point.
I’m not quite sure how I would structure the two post lists, though. I think the answer is in the theme docs, because those talk about lists vs pages, something which other static generators have in the “content” section, rather than the “theme” section, which probably is why I missed it.
Correct. Then that would be index.html as that theme I linked does.
That is very easy… those sub-directories need to be in your content/ dir, and then the theme deals with the visual representation of those.
Correct.
Hugo has very clean division between “what to present” and “how to present”. The former would go in content/ (or data/, or static/), and the latter would go to layouts/ (or the themes/THEME/layouts/).
I see, thank you. After reading the docs on themes a bit, things are becoming clearer. However, I still have one question:
It looks like the home page can only be specified by the theme, is that correct? I.e. I can’t have an content/index.md file with type page and my text of choice on it? Only things in my config.toml and index.html theme file can be displayed on the home page, right?
If you want to take a look at an example of what you’re trying to do, take a look at the repo for my personal site, it’s basically the same thing I think.