61 lines
2.6 KiB
XML
61 lines
2.6 KiB
XML
{{- $pctx := . }}
|
|
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
|
|
{{- $pages := slice }}
|
|
{{- if or $.IsHome $.IsSection }}
|
|
{{- $pages = $pctx.RegularPages }}
|
|
{{- else }}
|
|
{{- $pages = $pctx.Pages }}
|
|
{{- end }}
|
|
{{- $limit := .Site.Config.Services.RSS.Limit }}
|
|
{{- if ge $limit 1 }}
|
|
{{- $pages = $pages | first $limit }}
|
|
{{- end }}
|
|
{{- with .Site.Config.Services.RSS.Limit -}}
|
|
{{- if ge . 1 -}}
|
|
{{- $pages = $pages | first . -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{ print "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
|
{{- printf "<?xml-stylesheet href=\"/atom.xsl\" type=\"text/xsl\"?>" | safeHTML }}
|
|
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:webfeeds="http://webfeeds.org/rss/1.0">
|
|
{{ with .Site.Author.name }}
|
|
<author>
|
|
<name>{{ . }}</name>
|
|
<uri>{{ $.Site.BaseURL }}</uri>
|
|
</author>
|
|
{{ end }}
|
|
<generator uri="https://gohugo.io">Hugo {{ .Site.Hugo.Version }}</generator>
|
|
<id>{{ if .Site.Params.feedUUID }}urn:uuid:{{.Site.Params.feedUUID }}{{ else }}{{ .Permalink }}{{ end }}</id>
|
|
{{ with .OutputFormats.Get "atom" }}
|
|
{{ printf `<link rel="self" type="%s" href="%s" hreflang="%s"/>` .MediaType.Type .Permalink $.Site.LanguageCode | safeHTML }}
|
|
{{ end }}
|
|
{{ range .AlternativeOutputFormats }}
|
|
{{ printf `<link rel="alternate" type="%s" href="%s" hreflang="%s"/>` .MediaType.Type .Permalink $.Site.LanguageCode | safeHTML }}
|
|
{{ end }}
|
|
{{ with .Site.Params.icon }}<icon>{{ . | absURL }}</icon>{{ end }}
|
|
{{ with .Site.Params.logo }}<logo>{{ . | absURL }}</logo>{{ end }}
|
|
{{ with .Site.Copyright }}<rights>{{ replace . "{year}" now.Year }}</rights>{{ end }}
|
|
{{ with .Site.Params.Description }}<subtitle>{{ . }}</subtitle>{{ end }}
|
|
<title>{{ .Site.Title }}</title>
|
|
<updated>{{ now.Format .Site.Params.dateFormatAtomFeed | safeHTML }}</updated>
|
|
{{ with .Site.Params.icon96 }}<webfeeds:icon>{{ . | absURL }}</webfeeds:icon>{{ end }}
|
|
{{ range $pages }}
|
|
<entry>
|
|
{{ with .Params.Author }}
|
|
<author>
|
|
<name>{{ . }}</name>
|
|
</author>
|
|
{{ end }}
|
|
<id>tag:{{ $u := urls.Parse .Permalink }}{{ $u.Hostname }},{{ .Date.Format .Site.Params.dateFormatTag }}:{{ replace $u.Path "#" "_" }}</id>
|
|
<link rel="alternate" href="{{ .Permalink }}"/>
|
|
<title>{{ .Title }}</title>
|
|
<published>{{ .Date.Format .Site.Params.dateFormatAtomFeed | safeHTML }}</published>
|
|
<updated>{{ .Lastmod.Format .Site.Params.dateFormatAtomFeed | safeHTML }}</updated>
|
|
{{ with .Description }}<summary type="text">{{ . }}</summary>{{ end }}
|
|
<content type="html" xml:base="{{ .Site.BaseURL }}" xml:lang="en">
|
|
{{ printf "<![CDATA[%s]]>" .Content | safeHTML }}
|
|
</content>
|
|
</entry>
|
|
{{ end }}
|
|
</feed>
|