hugo-theme-feeds/layouts/partials/feeds/atom/base.xml
Eryn Wells 32762afb55 Fix several issues with the Atom feeds
- Make sure Author info populates correctly
- Sort posts by Date
- Remove un-dated posts from the feed
- Remove Draft posts from the feed if the site isn't in Development mode
2024-11-04 15:46:15 -08:00

29 lines
1.2 KiB
XML

{{- $context := .context -}}
{{- $pages := .pages -}}
{{- $limit := .limit -}}
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ $context.Site.Title }}</title>
{{ with $context.OutputFormats.Get "Atom" -}}
<link rel="self" type="application/atom+xml" href="{{ .Permalink }}" />
{{- end }}
<link href="{{ `/icons/favicon.png` | absURL }}" rel="shortcut icon" />
{{ with $context.Date -}}
<updated>{{ . | time.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
{{- end -}}
<id>{{ $context.Permalink }}</id>
{{ with $context.Site.Params.Author -}}
<author>
{{ with .name }}<name>{{ . }}</name>{{ end }}
{{ with .email }}<email>{{ . }}</email>{{ end }}
<uri>{{ $context.Site.Home.Permalink }}</uri>
</author>
{{- end }}
<generator version="{{ hugo.Version }}" uri="https://gohugo.io">Hugo {{ hugo.Version }}</generator>
<rights>© 2020-{{ now.Year }} Eryn Wells</rights>
{{ range $pages -}}
{{- if and (not .Date.IsZero) (or hugo.IsDevelopment (not .Draft)) -}}
{{ .Render "atom_entry" }}
{{- end -}}
{{- end -}}
</feed>