summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Eriksen <d@ennis.no>2020-03-29 17:44:07 +0200
committerDennis Eriksen <d@ennis.no>2020-03-29 17:44:07 +0200
commit52f71fd820858206d823c2d967dd0abbd9e2e8d2 (patch)
treeb5011dec8016fb429e076f2e5b3d5f1b0c38691c
parentadding support for hidden pages (diff)
downloadrikerz-52f71fd820858206d823c2d967dd0abbd9e2e8d2.tar.gz
adding atom feed
-rw-r--r--layouts/index.atom.xml36
-rw-r--r--layouts/index.rss.xml (renamed from layouts/index.xml)0
2 files changed, 36 insertions, 0 deletions
diff --git a/layouts/index.atom.xml b/layouts/index.atom.xml
new file mode 100644
index 0000000..7443f34
--- /dev/null
+++ b/layouts/index.atom.xml
@@ -0,0 +1,36 @@
+{{- $pctx := . -}}
+{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- $pages := slice -}}
+{{- if or $.IsHome $.IsSection -}}
+{{- $pages = $pctx.RegularPages -}}
+{{- else -}}
+{{- $pages = $pctx.Pages -}}
+{{- end -}}
+{{- $limit := .Site.Config.Services.RSS.Limit -}}
+{{- if ge $limit 1 -}}
+{{- $pages = $pages | first $limit -}}
+{{- end -}}
+<feed xmlns="http://www.w3.org/2005/Atom">
+ <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
+ <link href="{{ .Permalink }}feed.xml" rel="self"/>
+ <link href="{{ .Permalink }}"/>{{ if not .Date.IsZero }}
+ <updated>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>{{end}}
+ <id>{{ .Permalink }}</id>{{ with .Site.Author.name }}
+ <author>
+ <name>{{.}}</name>{{ with $.Site.Author.email }}
+ <email>{{.}}</email>{{end}}
+ </author>{{end}}
+ <generator>Hugo -- gohugo.io</generator>
+ {{ range where $pages "Params.hidden" "ne" "true" }}
+ <entry>
+ {{ `<title type="html"><![CDATA[` | safeHTML }}{{ .Title }}]]></title>
+ <link href="{{ .Permalink }}"/>
+ <id>{{ .Permalink }}</id>{{ with .Site.Params.Author }}
+ <author>
+ <name>{{.}}</name>
+ </author>{{end}}
+ <published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
+ <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
+ {{ `<content type="html"><![CDATA[` | safeHTML }}{{ .Content }}]]></content>
+ </entry>{{ end }}
+</feed>
diff --git a/layouts/index.xml b/layouts/index.rss.xml
index 849e0f0..849e0f0 100644
--- a/layouts/index.xml
+++ b/layouts/index.rss.xml