site/layouts/_default/section.atom.xml

34 lines
1.1 KiB
XML

{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>hedy's blog</title>
<link href="{{ .Permalink }}"/>
<updated>{{ .Date.Format "2006-01-02" | safeHTML }}T12:00:00Z</updated>
<id>{{ .Permalink }}</id>
<author>
<name>{{ $.Site.Author.name }}</name>
<email>{{ $.Site.Author.email }}</email>
</author>
{{- range where .Site.Pages "Kind" "page" }}
{{- if or (eq .Section "posts") (eq .Section "post") }}
<entry>
<title>{{ .Title }}</title>
{{ printf `<link rel="alternate" href="%s" />` .Permalink | safeHTML }}
<id>{{ .Permalink }}</id>
<updated>{{ .Date.Format "2006-01-02" }}T12:00:00Z</updated>
<author>
<name>{{ $.Site.Author.name }}</name>
<email>{{ $.Site.Author.email }}</email>
</author>
</entry>
{{- end }}
{{- end }}
</feed>