Skip to content

Commit eeb9a89

Browse files
stumbopamoroso
andauthored
Rss feed fix (#293)
* Update social icons in footer Add to the site footer an icon linking to the YouTube channel as per issue #2239. Change the email entry to direct to [email protected] instead of the Interlisp Users mailing list, which addresses issue #1426. Signed-off-by: Paolo Amoroso <[email protected]> * Fixes rss feed. Changes to _index.md are now included. The code was including all the pages within a section but not the section index, _index.md. This was fixed by specifically adding the section index page: ``` {{- $pages = $pages | union (slice .) }} ``` and then adding the pages within the section: ``` {{- $pages = $pages | union (slice .) }} ``` In addition, the pages are ordered via Publish Date before the resulting feed is build. --------- Signed-off-by: Paolo Amoroso <[email protected]> Co-authored-by: Paolo Amoroso <[email protected]>
1 parent 202edf6 commit eeb9a89

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

layouts/_default/rss.xml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<!-- Print XML declaration -->
2+
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
3+
14
{{- $authorName := "" }}
25
{{- with .Site.Params.author }}
36
{{- if reflect.IsMap . }}
@@ -9,33 +12,42 @@
912
{{- end }}
1013
{{- end }}
1114

12-
{{- $pctx := . }}
13-
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
14-
1515
<!-- Iterate through all sections and include both sections and
1616
pages in the rss feed. The default rss.xml only includes
1717
pages. -->
1818
{{- $pages := slice }}
19-
{{- $mainPages := where .Pages "Kind" "in" (slice "page" "section") }}
19+
20+
<!-- Include the current list page (_index.md) if we're on home or a section -->
21+
{{- $pages = $pages | union (slice .) }}
22+
{{- $mainPages := where .Pages "Kind" "in" (slice "page" ) }}
2023
{{- $pages = $pages | union $mainPages }}
2124

25+
26+
<!-- Loop through each section and add it's _index.md and child pages -->
2227
{{- range .Sections }}
23-
{{- $sectionPages := where .Pages "Kind" "in" (slice "page" "section") }}
28+
{{- $sectionPages := where .Pages "Kind" "in" (slice "page") }}
29+
{{- $pages = $pages | union (slice .) }}
2430
{{- $pages = $pages | union $sectionPages }}
31+
<!-- Loop through any subsections adding their _index.md and child pages -->
2532
{{- range .Sections }}
26-
{{- $subSectionPages := where .Pages "Kind" "in" (slice "page" "section") }}
33+
{{- $subSectionPages := where .Pages "Kind" "in" (slice "page") }}
34+
{{- $pages = $pages | union (slice .) }}
2735
{{- $pages = $pages | union $subSectionPages }}
2836
{{- end }}
2937
{{- end }}
3038

39+
<!-- order entries by PublishDate-->
40+
{{- $pages = sort $pages "PublishDate" "desc" }}
41+
3142
{{- $limit := .Site.Config.Services.RSS.Limit }}
3243
{{- if ge $limit 1 }}
3344
{{- $pages = $pages | first $limit }}
3445
{{- end }}
3546

47+
<!-- Build the actual feed using the page list-->
3648
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
3749
<channel>
38-
<title>Updates from the Medley Interlisp Project</title>
50+
<title>Updates from the new Medley Interlisp Project</title>
3951
<link>{{ .Permalink }}</link>
4052
<description>Updates from the Medley Interlisp Project</description>
4153
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}

0 commit comments

Comments
 (0)