From 8e5faf881389c5c9a5623a8bc5caddcf9bb9bf54 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Tue, 13 Dec 2022 21:45:07 -0800 Subject: [PATCH] Add excluderss page parameter --- README.md | 3 +++ layouts/_default/rss.xml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 85250d0a..0fb5b83b 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,9 @@ an anchor around the page title, if any. If the page or site parameter The `paige-search` layout provides full site search. It requires setting `outputs.home` to `["html", "json", "rss"]` in `config.yaml`. +Set page parameter `excluderss` to true to exclude it from RSS. Doing so +for a list page excludes the entire directory. + If `partials/paige-head-last.html` exists in the site, it is included at the end of the head tag. If `partials/paige-body-last.html` exists in the site, it is included at the end of the body tag. diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index bda55ac8..5f72bc28 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -2,6 +2,7 @@ {{ if .IsHome }} {{ $item = .Site }} {{ end }} +{{ if not .Params.excluderss }} {{ $pages := slice }} {{ if or $.IsHome $.IsSection }} {{ $pages = $item.RegularPages }} @@ -12,6 +13,7 @@ {{ if ge $limit 1 }} {{ $pages = $pages | first $limit }} {{ end }} +{{ $pages = where $pages "Params.excluderss" "ne" true }} {{ $title := partial "paige-titles.html" . }} {{ printf "" | safeHTML }} @@ -65,3 +67,4 @@ {{ end }} +{{ end }}