mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-23 11:01:37 +01:00
refactor rss template
This commit is contained in:
parent
4b45709402
commit
73484a80d7
@ -42,42 +42,39 @@
|
|||||||
{{- 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" xmlns:content="http://purl.org/rss/1.0/modules/content/">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
|
||||||
<title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }}</title>
|
<title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }}</title>
|
||||||
<link>{{ .Permalink }}</link>
|
<link rel="alternate" href="{{ (.OutputFormats.Get "HTML").Permalink }}" />
|
||||||
<description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }}</description>
|
<link rel="self" href="{{ (.OutputFormats.Get "RSS").Permalink }}" />
|
||||||
{{- with site.Params.images }}
|
<subtitle>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }}</subtitle>
|
||||||
<image>
|
<id>{{ .Permalink }}</id>
|
||||||
<title>{{ site.Title }}</title>
|
<generator uri="http://gohugo.io" version="{{ hugo.Version }}">Hugo</generator>
|
||||||
<url>{{ index . 0 | absURL }}</url>
|
<language>{{ site.Language.LanguageCode }}</language>
|
||||||
<link>{{ index . 0 | absURL }}</link>
|
<updated>{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</updated>
|
||||||
</image>
|
<author>
|
||||||
{{- end }}
|
{{ with $authorName }}<name>{{ . }}</name>{{ end }}
|
||||||
<generator>Hugo -- gohugo.io</generator>
|
{{ with $authorEmail }}<name>{{ . }}</name>{{ end }}
|
||||||
<language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }}
|
</author>
|
||||||
<managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
|
{{ with site.Copyright }}<rights>{{ . }}</rights>{{ end }}
|
||||||
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with site.Copyright }}
|
|
||||||
<copyright>{{ . }}</copyright>{{ end }}{{ 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 }}
|
|
||||||
{{- range $pages }}
|
{{- range $pages }}
|
||||||
{{- if and (ne .Layout `search`) (ne .Layout `archives`) }}
|
{{- if and (ne .Layout `search`) (ne .Layout `archives`) }}
|
||||||
<item>
|
<entry>
|
||||||
<title>{{ .Title }}</title>
|
<title>{{ .Title }}</title>
|
||||||
<link>{{ .Permalink }}</link>
|
<link rel="alternate" href="{{ .Permalink }}" />
|
||||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
<id>{{ .Permalink }}</id>
|
||||||
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
|
<published>{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</published>
|
||||||
<guid>{{ .Permalink }}</guid>
|
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</updated>
|
||||||
<description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
|
<summary type="html">{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</summary>
|
||||||
{{- if site.Params.ShowFullTextinRSS }}
|
{{- if site.Params.ShowFullTextinRSS }}
|
||||||
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
|
<content type="html">{{ .Content | html }}</content>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</item>
|
</entry>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</channel>
|
|
||||||
</rss>
|
</feed>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user