lukeorth / poison

Professional Hugo theme for dev bloggers. Based on Mdo's classic Hyde theme.
https://poison.lukeorth.com
GNU General Public License v3.0
198 stars 98 forks source link

Add parameter to configure base page content. #132

Closed JMicheli closed 11 months ago

JMicheli commented 11 months ago

By default, the content assembled for the base page ("/") is filtered to include only "posts" content because it iterates over the range where .Site.RegularPages "Type" "posts". This means that if a user has several non-"posts" page bundles listed in their sidebar, this content will not appear on the front page. This is also a problem if a site is structured so that it doesn't include a "posts" page bundle; in this case, nothing will appear on the front at all.

My pull request adds a new config parameter, front_page_content, which takes a list of page bundle names that will be included in the front page range. This is accomplished with minimal changes to the layouts/index.html file, to make it iterate over the range where their type is in the front_page_content list instead; it also defaults to the original behavior if a user does not define the parameter in their config file, so it shouldn't impact any existing configs.

This behavior is helpful to the site that I am currently building using the theme, and I imagine it could be useful to others as well. I'm happy to make any further changes needed to get this pull request incorporated into the master branch.

Some possible considerations:

lukeorth commented 11 months ago

Hi @JMicheli -- thank you for this contribution. I like it!

I agree that including an explanation in the README for this would be beneficial. Just let me know if you'd like to add it to this PR before merging (otherwise we can open a new one).

Thanks again!

JMicheli commented 11 months ago

I added documentation to the README showing how to use the parameter. Feel free to review and adjust the phrasing if I didn't get the voice right. I also added annotations to some code blocks that were giving me linter errors, hopefully that's okay.

lukeorth commented 11 months ago

This is perfect. Thank you, @JMicheli! :tada: