diff options
author | Florian Wilkens <gh@1wilkens.org> | 2019-10-29 11:37:56 +0300 |
---|---|---|
committer | Guillermo Guerrero Ibarra <wolf.fox1985@gmail.com> | 2019-10-29 11:37:56 +0300 |
commit | d809b617f8cdf31d49691b26d82e1b1d7fdcb01e (patch) | |
tree | cc51b241ea873420d100f32b0392cb2e1d548805 | |
parent | a7a7a8aec6873b14a9a66f2cfc60c54cc70956a6 (diff) |
[footer] Show recent posts from all mainSections (#228)
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.
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/partials/footer.html | 2 |
3 files changed, 3 insertions, 2 deletions
@@ -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. diff --git a/exampleSite/config.toml b/exampleSite/config.toml index b3dfcb0..aa1fac5 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -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 diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index bdb3a03..d830678 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -19,7 +19,7 @@ <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 }}"> |