mirror of
https://github.com/thegeeklab/hugo-geekblog.git
synced 2024-11-24 14:00:42 +00:00
72 lines
3.6 KiB
XML
72 lines
3.6 KiB
XML
{{ printf `<?xml version="1.0" encoding="utf-8"?>` | safeHTML }} {{/* ref: https://validator.w3.org/feed/docs/atom.html */}}
|
|
<feed xmlns="http://www.w3.org/2005/Atom"{{ with .Site.Language.Lang }} xml:lang="{{ . }}"{{ end }}>
|
|
<generator uri="https://gohugo.io/" version="{{ hugo.Version }}">Hugo</generator>
|
|
{{- $title := .Site.Title -}}
|
|
{{- with .Title -}}
|
|
{{- if (not (eq . $title)) -}}
|
|
{{- $title = printf `%s on %s` . $title -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{ printf `<title type="html"><![CDATA[%s]]></title>` $title | safeHTML }}
|
|
{{ with .Site.Params.subtitle }}
|
|
{{ printf `<subtitle type="html"><![CDATA[%s]]></subtitle>` . | safeHTML }}
|
|
{{ end }}
|
|
{{ $output_formats := .OutputFormats }}
|
|
{{ range $output_formats -}}
|
|
{{- $rel := (or (and (eq "atom" (.Name | lower)) "self") "alternate") -}}
|
|
{{ with $output_formats.Get .Name }}
|
|
{{ printf `<link href=%q rel=%q type=%q title=%q />` .Permalink $rel .MediaType.Type .Name | safeHTML }}
|
|
{{- end -}}
|
|
{{- end }}
|
|
<updated>{{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
|
|
{{ with .Site.Params.GeekblogAuthor -}}
|
|
{{ with index $.Site.Data.authors . }}
|
|
<author>
|
|
<name>{{ .name }}</name>
|
|
{{ with .email }}
|
|
<email>{{ . }}</email>
|
|
{{ end -}}
|
|
</author>
|
|
{{ end }}
|
|
{{- end }}
|
|
<id>{{ .Permalink }}</id>
|
|
{{- $pages := where .RegularPages "Type" "in" .Site.Params.mainSections -}}
|
|
{{- if (eq .Kind "home") -}}
|
|
{{- $pages = where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
|
|
{{- end -}}
|
|
{{- range $pages }}
|
|
{{ $page := . }}
|
|
<entry>
|
|
{{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }}
|
|
<link href="{{ .Permalink }}?utm_source=atom_feed" rel="alternate" type="text/html" {{ with .Site.Language.Lang }} hreflang="{{ . }}"{{ end }} />
|
|
<id>{{ .Permalink }}</id>
|
|
{{ with .Params.authors -}}
|
|
{{- range sort . -}}
|
|
{{ $author := index $.Site.Data.authors . }}
|
|
<author>
|
|
<name>{{ $author.name }}</name>
|
|
</author>
|
|
{{- end -}}
|
|
{{- 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>
|
|
{{ $desc := .Description | default "" }}
|
|
{{ $description := (cond (eq "" $desc) "" (printf "<blockquote>%s</blockquote>" ($desc | $.Page.RenderString))) }}
|
|
{{ printf `<content type="html"><![CDATA[%s%s]]></content>` $description .Content | safeHTML }}
|
|
{{ with .Site.Taxonomies }}
|
|
{{ range $taxo,$_ := . }} <!-- Defaults taxos: "tags", "categories" -->
|
|
{{ with $page.Param $taxo }}
|
|
{{ $taxo_list := . }} <!-- $taxo_list will be the tags/categories list -->
|
|
{{ with $.Site.GetPage (printf "/%s" $taxo) }}
|
|
{{ $taxonomy_page := . }}
|
|
{{ range $taxo_list }} <!-- Below, assuming pretty URLs -->
|
|
<category scheme="{{ printf "%s%s" $taxonomy_page.Permalink (. | urlize) }}" term="{{ (. | urlize) }}" label="{{ . }}" />
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
</entry>
|
|
{{ end }}
|
|
</feed>
|