aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--themes/default/layouts/_default/rss.xml36
1 files changed, 25 insertions, 11 deletions
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 "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML -}}
{{- end -}}
{{- $author := partial "function-authors-data.html" . -}}
@@ -29,21 +46,18 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
- <title>{{ partial "base-title" . }}</title>
+ <title>{{ partial "base-title.html" . }}</title>
<link>{{ .Permalink }}</link>
- <description>Recent from {{ partial "base-title" . }}</description>
+ <description>Recent from {{ partial "base-title.html" . }}</description>
<language>{{ .Site.LanguageCode }}</language>
- <category>{{ partial "author-user" . }}</category>
+ <category>{{ partial "author-user.html" . }}</category>
<image>
- <title>{{ partial "base-title" . }}</title>
+ <title>{{ partial "base-title.html" . }}</title>
<url>{{ $image.Permalink }}</url>
<link>{{ .Permalink }}</link>
</image>
- {{ if not .Date.IsZero -}}
- <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
- {{ with .OutputFormats.Get "RSS" }}
- {{- printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML -}}
- {{ end }}
+ <lastBuildDate>{{ $lastBuildDate }}</lastBuildDate>
+ {{ $atomLink }}
{{- range $pages }}
{{ if and (not .Params.Unlisted) (not .ExpiryDate) }}
<item>