Skip to content

Commit

Permalink
Add recent posts parameter to hide summary (#283)
Browse files Browse the repository at this point in the history
Introduce a recent_posts.hide_summary flag to not show the contents
summary in the recent posts section.

Signed-off-by: Richard Leitner <[email protected]>
  • Loading branch information
g0hl1n authored Aug 1, 2021
1 parent e265efc commit abd457f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -409,6 +409,7 @@ You can enable it in the configuration file.
enable = true
title = "From our blog"
subtitle = "Pellen
hide_summary = false
```


Expand Down
1 change: 1 addition & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions layouts/partials/recent_posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ <h4><a href="{{ .Permalink }}">{{ .Title }}</a></h4>
{{ 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 -->
Expand Down

0 comments on commit abd457f

Please sign in to comment.