From 715a82f5acf80b125c5e5ead2ff5765c075efa6b Mon Sep 17 00:00:00 2001 From: leafee98 Date: Mon, 16 May 2022 20:41:20 +0800 Subject: [PATCH] multi RSS hyperlink base on section and taxonomy --- layouts/_default/rss.xml | 14 ++++++++++---- layouts/partials/footer.html | 25 +++++++++++++++++-------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index e49c966..a546783 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,15 +1,21 @@ {{- $pctx := . -}} {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} {{- $pages := slice -}} -{{- if or $.IsHome $.IsSection -}} -{{- $pages = $pctx.RegularPages -}} + +{{- if or $.IsHome -}} + {{/* remove page at top level from RSS, for exmaple "about" page */}} + {{- $pages = where $pctx.RegularPages "Type" "ne" "page" -}} +{{- else if $.IsSection -}} + {{- $pages = $pctx.RegularPages -}} {{- else -}} -{{- $pages = $pctx.Pages -}} + {{- $pages = $pctx.Pages -}} {{- end -}} + {{- $limit := .Site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} -{{- $pages = $pages | first $limit -}} + {{- $pages = $pages | first $limit -}} {{- end -}} + {{- printf "" | safeHTML }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index a8c558f..77499e3 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,18 +1,27 @@