summaryrefslogtreecommitdiff
path: root/layouts/home.gemini_atom.xml
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/home.gemini_atom.xml')
-rw-r--r--layouts/home.gemini_atom.xml58
1 files changed, 30 insertions, 28 deletions
diff --git a/layouts/home.gemini_atom.xml b/layouts/home.gemini_atom.xml
index fac5283..e738378 100644
--- a/layouts/home.gemini_atom.xml
+++ b/layouts/home.gemini_atom.xml
@@ -1,32 +1,34 @@
-{{- $authorName := "" }}
-{{- with site.Params.author }}
- {{- if reflect.IsMap . }}
- {{- with .name }}
- {{- $authorName = . }}
- {{- end }}
- {{- else }}
- {{- $authorName = . }}
- {{- end }}
-{{- end }}
-{{- if not $authorName }}
- {{- errorf "Missing author" }}
-{{- end }}
+{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }}
+{{/* The XML declaration is emitted before anything else, including the
+ variables below, since whitespace may not precede it. */}}
+{{ $authorName := "" }}
+{{ with site.Params.author }}
+ {{ if reflect.IsMap . }}
+ {{ with .name }}
+ {{ $authorName = . }}
+ {{ end }}
+ {{ else }}
+ {{ $authorName = . }}
+ {{ end }}
+{{ end }}
+{{ if not $authorName }}
+ {{ errorf "Missing author" }}
+{{ end }}
-{{- $authorEmail := "" }}
-{{- with site.Params.author }}
- {{- if reflect.IsMap . }}
- {{- with .email }}
- {{- $authorEmail = . }}
- {{- end }}
- {{- end }}
-{{- end -}}
+{{ $authorEmail := "" }}
+{{ with site.Params.author }}
+ {{ if reflect.IsMap . }}
+ {{ with .email }}
+ {{ $authorEmail = . }}
+ {{ end }}
+ {{ end }}
+{{ end }}
-{{- $pages := (where .Site.RegularPages "Section" "entry").ByPublishDate.Reverse }}
-{{- $limit := .Site.Config.Services.RSS.Limit }}
-{{- if ge $limit 1 }}
-{{- $pages = first $limit $pages }}
-{{- end -}}
-{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }}
+{{ $pages := (where .Site.RegularPages "Section" "entry").ByPublishDate.Reverse }}
+{{ $limit := .Site.Config.Services.RSS.Limit }}
+{{ if ge $limit 1 }}
+{{ $pages = first $limit $pages }}
+{{ end }}
<feed xmlns="http://www.w3.org/2005/Atom">
<id>{{ .Permalink | strings.TrimSuffix "index.gmi" }}</id>
<title>{{ .Site.Title }}</title>
@@ -35,7 +37,7 @@
<link href="{{ .Permalink | strings.TrimSuffix "index.gmi" | safeURL }}" rel="alternate" />
<author>
<name>{{ $authorName }}</name>
- {{- with $authorEmail }}
+ {{ with $authorEmail }}
<email>{{ . }}</email>{{ end }}
</author>
<generator>Hugo -- gohugo.io</generator>