Last active 1725838849

I DON'T THINK THIS SATISFIES THE https://validator.w3.org/feed/docs/atom.html#sampleFeed spec Modify hugo's default RSS feed to make the post's content shown be the post's full content and not only a short snippet of it. To be placed as layouts/index.xml (or renamed to whatever the feed name would be )

Revision b4ff6b4ec3674b1da6dbb6e5427920de9622f9d8

index.xml Raw
1{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
2{{- $authorEmail := "" }}
3{{- with site.Params.author }}
4 {{- if reflect.IsMap . }}
5 {{- with .email }}
6 {{- $authorEmail = . }}
7 {{- end }}
8 {{- end }}
9{{- else }}
10 {{- with site.Author.email }}
11 {{- $authorEmail = . }}
12 {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
13 {{- end }}
14{{- end }}
15
16{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
17{{- $authorName := "" }}
18{{- with site.Params.author }}
19 {{- if reflect.IsMap . }}
20 {{- with .name }}
21 {{- $authorName = . }}
22 {{- end }}
23 {{- else }}
24 {{- $authorName = . }}
25 {{- end }}
26{{- else }}
27 {{- with site.Author.name }}
28 {{- $authorName = . }}
29 {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
30 {{- end }}
31{{- end }}
32
33{{- $pctx := . }}
34{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
35{{- $pages := slice }}
36{{- if or $.IsHome $.IsSection }}
37{{- $pages = $pctx.RegularPages }}
38{{- else }}
39{{- $pages = $pctx.Pages }}
40{{- end }}
41{{- $limit := .Site.Config.Services.RSS.Limit }}
42{{- if ge $limit 1 }}
43{{- $pages = $pages | first $limit }}
44{{- end }}
45{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
46<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
47 <channel>
48 <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
49 <link>{{ .Permalink }}</link>
50 <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>
51 <generator>Hugo</generator>
52 <language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }}
53 <managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
54 <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
55 <copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
56 <lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
57 {{- with .OutputFormats.Get "RSS" }}
58 {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
59 {{- end }}
60 {{- range $pages }}
61 <item>
62 <title>{{ .Title }}</title>
63 <link>{{ .Permalink }}</link>
64 <pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
65 {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
66 <guid>{{ .Permalink }}</guid>
67 <description>{{ .Content | transform.XMLEscape | safeHTML }}</description>
68 </item>
69 {{- end }}
70 </channel>
71</rss>
72