summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleafee98 <leafee98@hotmail.com>2022-05-16 20:41:20 +0800
committerleafee98 <leafee98@hotmail.com>2022-05-16 20:41:20 +0800
commit715a82f5acf80b125c5e5ead2ff5765c075efa6b (patch)
treed64e0817e3ab9b129d13664739e9afc10901dfa7
parentb343bac3f9e267501d25068686f4eec0adaaab9d (diff)
multi RSS hyperlink base on section and taxonomy
-rw-r--r--layouts/_default/rss.xml14
-rw-r--r--layouts/partials/footer.html25
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 "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
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 @@
<footer class="footer">
<div class="footer-row">
- {{ if .IsHome }}
<a class="footer-item" href="{{ "/index.xml" | relURL }}">
- The Site Feed
+ Feed of ALL
<i class="icofont-rss"></i>
</a>
- {{ else }}
- <a class="footer-item" href="{{ "/index.xml" | relURL }}">
- The Site Feed
- <i class="icofont-rss"></i>
- </a>
+
+ {{ if gt (len .Site.Sections) 1 }}
+ {{ range .Site.Sections }}
+ {{ $page := . }}
+ {{ with .OutputFormats.Get "rss" }}
+ <a class="footer-item" href="{{ .Permalink }}">
+ Feed of {{ with $page.Title }}{{ $page.Title }}{{ end }}
+ <i class="icofont-rss"></i>
+ </a>
+ {{ end }}
+ {{ end }}
+ {{ end }}
+
+ {{ if not (or .IsHome .IsSection) }}
+ {{ $page := . }}
{{ with .OutputFormats.Get "rss" }}
<a class="footer-item" href="{{ .Permalink }}">
- The Taxonomy Feed
+ Feed of "{{ with $page.Title }}{{ $page.Title }}{{ end }}"
<i class="icofont-rss"></i>
</a>
{{ end }}