1 {{ printf `<?xml version="1.0" encoding="utf-8"?>` | safeHTML }}
2 <feed xmlns="http://www.w3.org/2005/Atom"{{ with site.LanguageCode }} xml:lang="{{ . }}"{{ end }}>
3 <generator uri="https://gohugo.io/" version="{{ hugo.Version }}">Hugo</generator>
4 {{- $title := site.Title -}}
6 {{- if (not (eq . site.Title)) -}}
7 {{- $title = printf `%s %s %s` . "on" site.Title -}}
10 {{- if .IsTranslated -}}
11 {{ $title = printf "%s (%s)" $title (index site.Data.i18n.languages .Lang) }}
13 {{ printf `<title type="html"><![CDATA[%s]]></title>` $title | safeHTML }}
14 {{ with (or (.Param "subtitle") (.Param "tagline")) }}
15 {{ printf `<subtitle type="html"><![CDATA[%s]]></subtitle>` . | safeHTML }}
17 {{ $output_formats := .OutputFormats }}
18 {{ range $output_formats -}}
19 {{- $rel := (or (and (eq "atom" (.Name | lower)) "self") "alternate") -}}
20 {{ with $output_formats.Get .Name }}
21 {{ printf `<link href=%q rel=%q type=%q title=%q />` .Permalink $rel .MediaType.Type .Name | safeHTML }}
24 {{- range .Translations }}
25 {{ $output_formats := .OutputFormats }}
27 {{- $langstr := index site.Data.i18n.languages .Lang }}
28 {{ range $output_formats -}}
29 {{ with $output_formats.Get .Name }}
30 {{ printf `<link href=%q rel="alternate" type=%q hreflang=%q title="[%s] %s" />` .Permalink .MediaType.Type $lang $langstr .Name | safeHTML }}
34 <updated>{{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
35 {{ with site.Copyright }}
36 {{- $copyright := replace . "{year}" now.Year -}} {{/* In case the site.copyright uses a special string "{year}" */}}
37 {{- $copyright = replace $copyright "©" "©" -}}
38 <rights>{{ $copyright | plainify }}</rights>
40 {{ with .Param "feed" }}
41 {{/* For this to work, the $icon file should be present in the assets/ directory */}}
42 {{- $icon := .icon | default "icon.svg" -}}
43 {{- with resources.Get $icon -}}
44 <icon>{{ (. | fingerprint).Permalink }}</icon>
47 {{/* For this to work, the $logo file should be present in the assets/ directory */}}
48 {{- $logo := .logo | default "logo.svg" -}}
49 {{- with resources.Get $logo -}}
50 <logo>{{ (. | fingerprint).Permalink }}</logo>
53 {{ with site.Author.name -}}
56 {{ with site.Author.email }}
57 <email>{{ . }}</email>
61 {{ with site.Params.id }}
62 <id>{{ . | plainify }}</id>
64 <id>{{ .Permalink }}</id>
66 {{- $limit := (cond (le site.Config.Services.RSS.Limit 0) 65536 site.Config.Services.RSS.Limit) }}
67 {{- $feed_sections := site.Params.feedSections | default site.Params.mainSections -}}
68 {{/* Range through only the pages with a Type in $feed_sections. */}}
69 {{- $pages := where .RegularPages "Type" "in" $feed_sections -}}
70 {{- if (eq .Kind "home") -}}
71 {{- $pages = where site.RegularPages "Type" "in" $feed_sections -}}
73 {{/* Remove the pages that have the disable_feed parameter set to true. */}}
74 {{- $pages = where $pages ".Params.disable_feed" "!=" true -}}
75 {{- range first $limit $pages }}
78 {{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }}
79 <link href="{{ .Permalink }}?utm_source=atom_feed" rel="alternate" type="text/html" />
80 {{- range .Translations }}
81 {{- $link := printf "%s?utm_source=atom_feed" .Permalink | safeHTML }}
82 {{- printf `<link href=%q rel="alternate" type="text/html" hreflang=%q />` $link .Lang | safeHTML }}
84 {{- range first 5 (site.RegularPages.Related .) }}
85 <link href="{{ .Permalink }}?utm_source=atom_feed" rel="related" type="text/html" title="{{ .Title }}" />
88 <id>{{ . | plainify }}</id>
90 <id>{{ .Permalink }}</id>
92 {{ with .Params.author -}}
93 {{- range . -}} <!-- Assuming the author front-matter to be a list -->
99 <published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
100 <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
101 {{ $description1 := .Description | default "" }}
102 {{ $description := (cond (eq "" $description1) "" (printf "<blockquote>%s</blockquote>" ($description1 | markdownify))) }}
103 {{ printf `<content type="html"><![CDATA[%s%s]]></content>` $description .Content | safeHTML }}
104 {{ with site.Taxonomies }}
105 {{ range $taxo,$_ := . }} <!-- Defaults taxos: "tags", "categories" -->
106 {{ with $page.Param $taxo }}
107 {{ $taxo_list := . }} <!-- $taxo_list will be the tags/categories list -->
108 {{ with site.GetPage (printf "/%s" $taxo) }}
109 {{ $taxonomy_page := . }}
110 {{ range $taxo_list }} <!-- Below, assuming pretty URLs -->
111 <category scheme="{{ printf "%s%s" $taxonomy_page.Permalink (. | urlize) }}" term="{{ (. | urlize) }}" label="{{ . }}" />