Skip to content

Commit

Permalink
[footer] Show recent posts from all mainSections (#228)
Browse files Browse the repository at this point in the history
Similar to the `recent_posts.html` partial the footer currently only shows posts from the hardcoded 'blog' type.
This commit changes this to all `mainSections` of the site.
  • Loading branch information
1wilkens authored and ryanfox1985 committed Oct 29, 2019
1 parent a7a7a8a commit d809b61
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ Then, you can enable the section in the configuration file.

#### Recent posts

The recent posts sections shows the four latest published blog posts, with their featured image and a summary.
The recent posts sections shows the four latest published blog posts, with their featured image and a summary. It defaults to show recent posts from all [main sections](https://gohugo.io/functions/where/#mainsections). This is either the section with the most posts or can be set explicitly in the configuration file (see linked docs).

You can enable it in the configuration file.

Expand Down
1 change: 1 addition & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ paginate = 10
viewMorePostLink = "/blog/"
author = "DevCows"
defaultKeywords = ["devows", "hugo", "go"]
mainSections = ["blog"]
defaultDescription = "Site template made by devcows using hugo"

# Social media
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h4>{{ i18n "aboutUs" }}</h4>
<h4>{{ i18n "recentPosts" }}</h4>

<div class="blog-entries">
{{ range first 3 (where .Site.RegularPages "Type" "blog") }}
{{ range first 3 (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
<div class="item same-height-row clearfix">
<div class="image same-height-always">
<a href="{{ .Permalink }}">
Expand Down

0 comments on commit d809b61

Please # to comment.