diff options
author | tdro <tdro@noreply.example.com> | 2022-12-06 23:43:53 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-12-06 23:43:53 -0500 |
commit | 0f64a4206a109e4643aca07772d6091f9607068c (patch) | |
tree | 750152654fd316c5bd93b0503a1c55812e46795e /themes/default/layouts/_default | |
parent | cf600839a84be5245397c22658462edbea001157 (diff) | |
download | canory-0f64a4206a109e4643aca07772d6091f9607068c.tar.gz canory-0f64a4206a109e4643aca07772d6091f9607068c.tar.bz2 canory-0f64a4206a109e4643aca07772d6091f9607068c.zip |
themes/default/layouts/partials: Consolidate the content filter into a function
Diffstat (limited to 'themes/default/layouts/_default')
-rw-r--r-- | themes/default/layouts/_default/index.json | 4 | ||||
-rw-r--r-- | themes/default/layouts/_default/rss.xml | 9 | ||||
-rw-r--r-- | themes/default/layouts/_default/sitemap.xml | 4 |
3 files changed, 7 insertions, 10 deletions
diff --git a/themes/default/layouts/_default/index.json b/themes/default/layouts/_default/index.json index 7cfd37d..6cbc1ef 100644 --- a/themes/default/layouts/_default/index.json +++ b/themes/default/layouts/_default/index.json @@ -7,9 +7,7 @@ "next_url": "{{ .URL | absURL }}", {{- end }} "items": [ - {{- $notExpired := where .Paginator.Pages "Params.expirydate" "eq" nil -}} - {{- $notUnlisted := where .Paginator.Pages "Params.unlisted" "eq" nil -}} - {{- $filteredPages := $notExpired | intersect $notUnlisted -}} + {{- $filteredPages := partial "function-filters-content.html" .Paginator.Pages -}} {{- range $index, $data := $filteredPages -}} {{- if and $index (gt $index 0) -}},{{- end }} { diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml index 8248cc1..01f2aa6 100644 --- a/themes/default/layouts/_default/rss.xml +++ b/themes/default/layouts/_default/rss.xml @@ -52,6 +52,8 @@ {{- end -}} {{- end -}} +{{- $filteredPages := partial "function-filters-content.html" .Paginator.Pages -}} + {{- printf `<?xml version="1.0" encoding="utf-8" standalone="yes"?>` | safeHTML }} {{ printf `<?xml-stylesheet href="/rss.xsl" type="text/xsl"?>` | safeHTML }} @@ -77,7 +79,7 @@ {{ $atomPrevious }} {{ $atomNext }} - {{ range first $limit .Paginator.Pages }} + {{ range first $limit $filteredPages -}} {{- $author = partial "function-authors-data.html" . -}} {{- $profile = $author.picture.profile -}} @@ -104,7 +106,6 @@ {{- $atomAuthorUri = .Params.Feed.favicon | absURL -}} {{- end -}} - {{ if and (not .Params.Unlisted) (not .ExpiryDate) }} <item> <title>{{ .Summary | htmlUnescape }}</title> <link>{{ .Permalink }}</link> @@ -120,7 +121,7 @@ <atom:uri>{{ $atomAuthorUri }}</atom:uri> </atom:author> </item> - {{ end -}} - {{ end }} + + {{ end -}} </channel> </rss> diff --git a/themes/default/layouts/_default/sitemap.xml b/themes/default/layouts/_default/sitemap.xml index b751f65..fdbc045 100644 --- a/themes/default/layouts/_default/sitemap.xml +++ b/themes/default/layouts/_default/sitemap.xml @@ -9,9 +9,7 @@ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" > - {{- $notExpired := where .Data.Pages "Params.expirydate" "eq" nil -}} - {{- $notUnlisted := where .Data.Pages "Params.unlisted" "eq" nil -}} - {{- $filteredPages := $notExpired | intersect $notUnlisted -}} + {{- $filteredPages := partial "function-filters-content.html" .Data.Pages -}} {{- range $filteredPages }} {{- with .Sitemap.ChangeFreq -}} |