mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
rss: adjust to Hugo's build-in code #824
This commit is contained in:
parent
b262c0b1a3
commit
c69541e983
1 changed files with 6 additions and 5 deletions
|
@ -16,11 +16,12 @@
|
||||||
{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
|
{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
|
||||||
{{- $authorName := partialCached "authorname.hugo" . }}
|
{{- $authorName := partialCached "authorname.hugo" . }}
|
||||||
|
|
||||||
{{- $pages := .Page.Pages }}
|
{{- $pages := .Pages }}
|
||||||
{{- $limit := .Site.Config.Services.RSS.Limit }}
|
{{- $limit := .Site.Config.Services.RSS.Limit }}
|
||||||
{{- if ge $limit 0 }}
|
{{- if ge $limit 1 }}
|
||||||
{{- $pages = $pages | first $limit }}
|
{{- $pages = $pages | first $limit }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- $page := . }}
|
{{- $page := . }}
|
||||||
{{- 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">
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
<managingEditor>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
|
<managingEditor>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
|
||||||
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
|
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
|
||||||
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
|
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
|
||||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||||
{{- with .OutputFormats.Get "rss" }}
|
{{- with .OutputFormats.Get "rss" }}
|
||||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" ( partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true)) .MediaType | safeHTML }}
|
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" ( partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true)) .MediaType | safeHTML }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -43,10 +44,10 @@
|
||||||
<item>
|
<item>
|
||||||
<title>{{ .Title }}</title>
|
<title>{{ .Title }}</title>
|
||||||
<link>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</link>
|
<link>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</link>
|
||||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||||
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
|
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
|
||||||
<guid>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</guid>
|
<guid>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</guid>
|
||||||
<description>{{ .Summary | html }}</description>
|
<description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>
|
||||||
</item>
|
</item>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
Loading…
Reference in a new issue