multi RSS hyperlink base on section and taxonomy
This commit is contained in:
parent
b343bac3f9
commit
715a82f5ac
|
@ -1,15 +1,21 @@
|
||||||
{{- $pctx := . -}}
|
{{- $pctx := . -}}
|
||||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||||
{{- $pages := slice -}}
|
{{- $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 -}}
|
{{- else -}}
|
||||||
{{- $pages = $pctx.Pages -}}
|
{{- $pages = $pctx.Pages -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- $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 -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
|
|
|
@ -1,18 +1,27 @@
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="footer-row">
|
<div class="footer-row">
|
||||||
{{ if .IsHome }}
|
|
||||||
<a class="footer-item" href="{{ "/index.xml" | relURL }}">
|
<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>
|
<i class="icofont-rss"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
{{ if gt (len .Site.Sections) 1 }}
|
||||||
|
{{ range .Site.Sections }}
|
||||||
|
{{ $page := . }}
|
||||||
{{ with .OutputFormats.Get "rss" }}
|
{{ with .OutputFormats.Get "rss" }}
|
||||||
<a class="footer-item" href="{{ .Permalink }}">
|
<a class="footer-item" href="{{ .Permalink }}">
|
||||||
The Taxonomy Feed
|
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 }}">
|
||||||
|
Feed of "{{ with $page.Title }}{{ $page.Title }}{{ end }}"
|
||||||
<i class="icofont-rss"></i>
|
<i class="icofont-rss"></i>
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in a new issue