From d07cf2691794e2d371ca5ea529428b5f58fac024 Mon Sep 17 00:00:00 2001 From: tdro Date: Tue, 4 Oct 2022 19:48:03 -0400 Subject: themes/default/layouts/_default/rss: Move logic outside --- themes/default/layouts/_default/rss.xml | 36 +++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'themes') diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml index 0364b25..6548c76 100644 --- a/themes/default/layouts/_default/rss.xml +++ b/themes/default/layouts/_default/rss.xml @@ -1,9 +1,26 @@ {{- $pageContext := . -}} -{{- if .IsHome -}}{{ $pageContext = .Site }}{{- end -}} + +{{- if .IsHome -}} + {{- $pageContext = .Site -}} +{{- end -}} + {{- $pages := $pageContext.RegularPages -}} {{- $limit := .Site.Config.Services.RSS.Limit -}} + {{- if ge $limit 1 -}} -{{- $pages = $pages | first $limit -}} + {{- $pages = $pages | first $limit -}} +{{- end -}} + +{{- $lastBuildDate := now.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} + +{{- if not .Date.IsZero -}} + {{- $lastBuildDate = .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} +{{- end -}} + +{{- $atomLink := "" -}} + +{{- with .OutputFormats.Get "RSS" -}} + {{- $atomLink = printf "" .Permalink .MediaType | safeHTML -}} {{- end -}} {{- $author := partial "function-authors-data.html" . -}} @@ -29,21 +46,18 @@ - {{ partial "base-title" . }} + {{ partial "base-title.html" . }} {{ .Permalink }} - Recent from {{ partial "base-title" . }} + Recent from {{ partial "base-title.html" . }} {{ .Site.LanguageCode }} - {{ partial "author-user" . }} + {{ partial "author-user.html" . }} - {{ partial "base-title" . }} + {{ partial "base-title.html" . }} {{ $image.Permalink }} {{ .Permalink }} - {{ if not .Date.IsZero -}} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} - {{ with .OutputFormats.Get "RSS" }} - {{- printf "" .Permalink .MediaType | safeHTML -}} - {{ end }} + {{ $lastBuildDate }} + {{ $atomLink }} {{- range $pages }} {{ if and (not .Params.Unlisted) (not .ExpiryDate) }} -- cgit v1.2.3