site/layouts/_default/section.gematom.xml

36 lines
1.3 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 gemlog</title>
<link href="{{ .Site.Params.geminiRoot }}"/>
<updated>{{ .Date.Format "2006-01-02" | safeHTML }}T12:00:00Z</updated>
<id>{{ .Site.Params.geminiRoot }}</id>
<author>
<name>{{ $.Site.Author.name }}</name>
<email>{{ $.Site.Author.email }}</email>
</author>
{{- range (where .Site.RegularPages "Section" "posts") -}}
{{- $p := . -}}
{{- with .OutputFormats.Get "gemtext" }}
<entry>
{{- $perm := replace (replace .Permalink "/gemini" "" 1) "/index.gmi" ".gmi" 1 }}
<title>{{ $p.Title }}</title>
{{ printf `<link rel="alternate" href="%s" />` $perm | safeHTML }}
<id>{{ $perm }}</id>
<updated>{{ $p.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>