Files
FixIt/layouts/_partials/feed/rss.html
T

67 lines
3.3 KiB
HTML

{{- $pages := .Pages -}}
{{- /* Front matter: password */ -}}
{{- $pages = where $pages "Params.password" "eq" nil -}}
{{- /* Front matter: hiddenFromFeed */ -}}
{{- $pages = where $pages "Params.hiddenFromFeed" "ne" true -}}
{{- if ge .Config.limit 1 -}}
{{- $pages = $pages | first .Config.limit -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<description>{{ .Site.Params.description | default .Site.Title }}</description>
{{- if and (.Site.Params.feed.follow.feedId) (.Site.Params.feed.follow.userId) }}
<follow_challenge>
<feedId>{{ .Site.Params.feed.follow.feedId }}</feedId>
<userId>{{ .Site.Params.feed.follow.userId }}</userId>
</follow_challenge>
{{- end }}
<generator>Hugo {{ hugo.Version }} &amp; FixIt {{ hugo.Store.Get "version" }}</generator>
<language>{{ .Site.Language.Locale }}</language>{{ with .Site.Params.author.email }}
<managingEditor>{{.}}{{ with $.Site.Params.author.name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with .Site.Params.author.email }}
<webMaster>{{ . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.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 $page := $pages }}
{{- $params := .Params | merge .Site.Params.Page }}
{{- $fullText := ((.Params.feed | default dict) | merge $.Config ).fulltext }}
{{- $author := partial "function/get-author-map.html" .Params.author }}
{{- $image := $params.featuredimagepreview | default $params.featuredimage }}
{{- with dict "Path" $image "Resources" .Resources | partial "function/resource.html" }}
{{- $image = .Permalink }}
{{- end }}
{{- with .Resources.GetMatch "featured-image" }}
{{- $image = .Permalink }}
{{- end }}
{{- with .Resources.GetMatch "featured-image-preview" }}
{{- $image = .Permalink }}
{{- end }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- with $author.email }}<author>{{ . }}{{ with $author.name }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ .Permalink }}</guid>
{{- with .GetTerms "categories" }}
{{- range . }}
<category domain="{{ .Permalink }}">{{ .LinkTitle }}</category>
{{- end }}
{{- end }}
{{- if $fullText }}
<description>
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome "FeaturedImage" $image | partial "function/xml-content.html" -}}
</description>
{{- else }}
<description>{{ (.Summary | default .Description | default .Title) | transform.XMLEscape | safeHTML }}</description>
{{- end }}
</item>
{{- end }}
</channel>
</rss>