blog/layouts/index.atom

49 lines
1.9 KiB
Text

{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ .Site.LanguageCode }}">
<title>{{ .Site.Title }}</title>
{{- with .Site.Params.brand.tagline }}
<subtitle>{{ . }}</subtitle>
{{- end }}
<id>{{ "/" | absLangURL }}</id>
<author>
<name>{{ .Site.Title }}</name>
<uri>{{ "/" | absLangURL }}</uri>
</author>
<generator>Hugo gohugo.io</generator>
{{- with .Site.Copyright }}
<rights>{{ . }}</rights>
{{- end }}
{{- with .Site.Params.brand.icon }}
<icon>{{ . | absURL }}</icon>
{{- end }}
{{- with .Site.Params.brand.logo }}
<logo>{{ . | absURL }}</logo>
{{- end }}
<updated>{{ dateFormat "2006-01-02T15:04:05Z" now.UTC | safeHTML }}</updated>
{{- 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 }}
{{- range $pages }}
<entry>
<title>{{ .Title }}</title>
{{- $author := index .Site.Data.authors (.Params.author | default "default") }}
<author>
<name>{{ $author.name }}</name>
<uri>{{ $author.uri }}</uri>
</author>
<id>{{ .Permalink }}</id>
<link href="{{ .Permalink }}" hreflang="{{ .Language.Lang }}"/>
<updated>{{ dateFormat "2006-01-02T15:04:05Z" .Lastmod.UTC | safeHTML }}</updated>
<published>{{ dateFormat "2006-01-02T15:04:05Z" .Date.UTC | safeHTML }}</published>
<content type="html">{{ trim .Content "\n" }}</content>
</entry>
{{- end }}
</feed>