From 6122059d8454cf9bf3dc7f277a26ffc26dc5284d Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 16 May 2022 03:12:57 +0200 Subject: Add Atom support --- layouts/_default/home.atom.xml | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 layouts/_default/home.atom.xml (limited to 'layouts/_default') diff --git a/layouts/_default/home.atom.xml b/layouts/_default/home.atom.xml new file mode 100644 index 0000000..ad20269 --- /dev/null +++ b/layouts/_default/home.atom.xml @@ -0,0 +1,51 @@ +{{ print ""| safeHTML }} + + {{ site.Title }} + {{ with site.Params.description }}{{ . }}{{ end }} + {{ with site.Home.OutputFormats.Get "Atom" }}{{ end }} + {{ with site.Author.name }} + {{.}} + {{ with site.Author.email }}{{.}}{{end}} + {{end}} + {{ with site.Params.Copyright }}{{ .}}{{end}} + Hugo + {{ if not site.LastChange.IsZero }}{{ site.LastChange.UTC.Format site.Params.dateFormatFeed }}{{ end }} + {{ $uuid := sha1 (site.BaseURL | absURL)}}urn:uuid:{{ substr $uuid 0 8 }}-{{ substr $uuid 8 4 }}-5{{ substr $uuid 13 3 }}-{{ substr $uuid 16 1 }}9{{ substr $uuid 17 2 }}-{{ substr $uuid 21 12 }} + {{ $feedsize := site.Params.feedSize | default 25 }} + {{- range first $feedsize (where site.RegularPages.ByDate.Reverse "Type" "in" site.Params.mainSections) }} + + {{- $url := .RelPermalink }}{{ $uuid := sha1 (.Permalink | absURL)}}{{ $page := .}} + + {{ range (.GetTerms "tags") }} + + {{ end }} + + {{ .Title | plainify}} + {{ (.PublishDate.Format site.Params.dateFormatFeed) | html }} + {{ if ne .Date .Lastmod }}{{ .Lastmod.UTC.Format site.Params.dateFormatFeed }}{{ end }} + urn:uuid:{{ substr $uuid 0 8 }}-{{ substr $uuid 8 4 }}-5{{ substr $uuid 13 3 }}-{{ substr $uuid 16 1 }}9{{ substr $uuid 17 2 }}-{{ substr $uuid 21 12 }} + {{ if .Params.author }} + {{- $author_type := (printf "%T" .Params.author) }} + {{- if eq $author_type "string" }} + + {{ .Params.author }} + + {{- else if eq $author_type "[]string" }} + {{ range .Params.author }} + + {{ .Name }} + + {{ end }} + {{- end }} + {{ end }} + +
+

{{ replaceRE "\n" " " (.Summary | plainify | safeHTML | chomp) }}

+
+
+
+ {{- end }} +
-- cgit v1.2.3