Skip to content

Commit 6bfe6b8

Browse files
author
Stephen Gutekanst
committed
improve rss feed support
Signed-off-by: Stephen Gutekanst <[email protected]>
1 parent e430dd2 commit 6bfe6b8

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ noClasses=false
1818

1919
[params]
2020
mainSections = ['2021', '2022', '2023']
21+
rss = true
2122

2223
[taxonomies]
2324
category = "categories"

content/archives.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
date: 2022-04-26
33
type: section
44
layout: "archives"
5-
---
5+
rss_ignore: true
6+
---

themes/minimal/layouts/_default/rss.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
{{- with .OutputFormats.Get "RSS" -}}
2626
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
2727
{{- end -}}
28-
{{ range $pages }}
28+
{{ range $pages }}{{ if ne .Params.rss_ignore true }}
2929
<item>
3030
<title>{{ .Title }}</title>
3131
<link>{{ .Permalink }}</link>
@@ -34,6 +34,6 @@
3434
<guid>{{ .Permalink }}</guid>
3535
<description>{{ .Content | html }}</description>
3636
</item>
37-
{{ end }}
37+
{{ end }}{{ end }}
3838
</channel>
3939
</rss>

themes/minimal/layouts/partials/head.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@
1212
<meta name="googlebot" content="index,follow,snippet,archive">
1313
{{ template "_internal/opengraph.html" . }}
1414
{{ template "_internal/twitter_cards.html" . }}
15-
</head>
15+
{{ if .Site.Params.rss }}
16+
{{ with .OutputFormats.Get "RSS" }}
17+
{{ printf `<link href="%s" rel="%s" type="%s" title="%s" />` .Permalink .Rel .MediaType.Type $.Site.Title | safeHTML }}
18+
{{ end }}
19+
{{ end }}
20+
</head>

0 commit comments

Comments
 (0)