Skip to content

Commit c4464ee

Browse files
fulltext rss feed
1 parent 67704e5 commit c4464ee

File tree

1 file changed

+11
-34
lines changed

1 file changed

+11
-34
lines changed

layouts/rss.xml

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
21
{{- $authorEmail := "" }}
32
{{- with site.Params.author }}
43
{{- if reflect.IsMap . }}
54
{{- with .email }}
65
{{- $authorEmail = . }}
76
{{- end }}
87
{{- 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 }}
148
{{- end }}
159

16-
{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
1710
{{- $authorName := "" }}
1811
{{- with site.Params.author }}
1912
{{- if reflect.IsMap . }}
@@ -23,61 +16,45 @@
2316
{{- else }}
2417
{{- $authorName = . }}
2518
{{- 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 }}
3119
{{- end }}
3220

3321
{{- $pctx := . }}
34-
{{- if .IsHome }}{{ $pctx = site }}{{ end }}
22+
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
3523
{{- $pages := slice }}
3624
{{- if or $.IsHome $.IsSection }}
3725
{{- $pages = $pctx.RegularPages }}
3826
{{- else }}
3927
{{- $pages = $pctx.Pages }}
4028
{{- end }}
41-
{{- $limit := site.Config.Services.RSS.Limit }}
29+
{{- $limit := .Site.Config.Services.RSS.Limit }}
4230
{{- if ge $limit 1 }}
4331
{{- $pages = $pages | first $limit }}
4432
{{- end }}
4533
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
46-
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
34+
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
4735
<channel>
48-
<title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }}</title>
36+
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
4937
<link>{{ .Permalink }}</link>
50-
<description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }}</description>
51-
{{- with site.Params.images }}
52-
<image>
53-
<title>{{ site.Title }}</title>
54-
<url>{{ index . 0 | absURL }}</url>
55-
<link>{{ index . 0 | absURL }}</link>
56-
</image>
57-
{{- end }}
58-
<generator>Hugo -- {{ hugo.Version }}</generator>
38+
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>
39+
<generator>Hugo</generator>
5940
<language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }}
6041
<managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
61-
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with site.Copyright }}
62-
<copyright>{{ . | markdownify | plainify | strings.TrimPrefix "© " }}</copyright>{{ end }}{{ if not .Date.IsZero }}
42+
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
43+
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
6344
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
6445
{{- with .OutputFormats.Get "RSS" }}
6546
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
6647
{{- end }}
6748
{{- range $pages }}
68-
{{- if and (ne .Layout `search`) (ne .Layout `archives`) }}
6949
<item>
7050
<title>{{ .Title }}</title>
7151
<link>{{ .Permalink }}</link>
7252
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
7353
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
74-
{{ if .Params.GUID }} <guid isPermaLink="false">{{ .Params.guid }}</guid> {{ else }} <guid isPermaLink="false">{{ .Permalink }}</guid> {{ end }}
75-
<description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
76-
{{- if and site.Params.ShowFullTextinRSS .Content }}
77-
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
78-
{{- end }}
54+
<guid>{{ .Permalink }}</guid>
55+
<description>{{ .Content | transform.XMLEscape | safeHTML }}</description>
7956
</item>
8057
{{- end }}
81-
{{- end }}
8258
</channel>
8359
</rss>
60+

0 commit comments

Comments
 (0)