Merge pull request #77 from Ambroisie/add-rss-disable-feature

Allow hiding posts from RSS feed
This commit is contained in:
Dmitry Kolosov 2021-01-24 13:40:34 +03:00 committed by GitHub
commit b43d933019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -16,6 +16,7 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/).
- Disqus - Disqus
- Utteranc.es - Utteranc.es
- RSS feeds - RSS feeds
* Hiding posts from the RSS feed
- Translations (en, ru, fr, pl) - Translations (en, ru, fr, pl)
- Custom CSS/JS - Custom CSS/JS
- Multilingual mode - Multilingual mode
@ -123,6 +124,9 @@ For production — allow all, for other — disallow all.
### Favorite posts ### Favorite posts
To mark posts as favorite just add `favorite: true` in post's front matter. It adds a "★" icon nearby post's title. To mark posts as favorite just add `favorite: true` in post's front matter. It adds a "★" icon nearby post's title.
### Hiding posts from RSS
To hide a post from the RSS feed, just add `disable_feed: true` to its front matter.
### Pagination on post single page ### Pagination on post single page
Enabled by `paginationSinglePost` param in `params` section of config. Enabled by `paginationSinglePost` param in `params` section of config.

View File

@ -1,6 +1,6 @@
{{- $pctx := . -}} {{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := $pctx.RegularPages -}} {{- $pages := where $pctx.RegularPages ".Params.disable_feed" "!=" true -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}} {{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}} {{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}} {{- $pages = $pages | first $limit -}}
@ -31,4 +31,4 @@
</item> </item>
{{ end }} {{ end }}
</channel> </channel>
</rss> </rss>