diff options
author | g0hl1n <g0hl1n@users.noreply.github.com> | 2021-08-02 02:10:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-02 02:10:49 +0300 |
commit | abd457f0d0199243eedbbb985df0d51608f6d45e (patch) | |
tree | 3b0539da2b13e664b14cc4d9ec1ebaf74219ca93 | |
parent | e265efc6bf6c290bd46c545c98f5ad892fb06857 (diff) |
Add recent posts parameter to hide summary (#283)
Introduce a recent_posts.hide_summary flag to not show the contents
summary in the recent posts section.
Signed-off-by: Richard Leitner <dev@bubus.at>
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/partials/recent_posts.html | 2 |
3 files changed, 5 insertions, 1 deletions
@@ -400,7 +400,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. 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). +The recent posts sections shows the four latest published blog posts, with their featured image and an optional 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. @@ -409,6 +409,7 @@ You can enable it in the configuration file. enable = true title = "From our blog" subtitle = "Pellen + hide_summary = false ``` diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 34ca6cb..c4fda7a 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -198,3 +198,4 @@ paginate = 10 enable = true title = "From our blog" subtitle = "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo." + hide_summary = false diff --git a/layouts/partials/recent_posts.html b/layouts/partials/recent_posts.html index b482966..f16b272 100644 --- a/layouts/partials/recent_posts.html +++ b/layouts/partials/recent_posts.html @@ -43,10 +43,12 @@ {{ end }} {{ i18n "publishedOn" }} {{ .Date.Format .Site.Params.date_format }} </p> + {{ if not .Site.Params.recent_posts.hide_summary }} <p class="intro">{{ .Summary }}</p> <p class="read-more"> <a href="{{ .Permalink }}" class="btn btn-template-main">{{ i18n "continueReading" }}</a> </p> + {{ end }} </div> </div> <!-- /.box-image-text --> |