Skip to content

Commit 167bf74

Browse files
committed
Add RSS Feed to History, Software and Project pages.
RSS Feed generates feed containing all subpages from these sections.
1 parent 0e207e8 commit 167bf74

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

config/_default/hugo.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# An overview of hugo configuration files can be found at:
66
# https://gohugo.io/getting-started/configuration/#configure-server
77
#
8+
# title: The title that appears in the navbar of every page. We have
9+
# edited navbar.html to not show the title in the navbar of the home page.
10+
title: "The Medley Interlisp Project"
811

912
# relativeURLs: Enable to force all relative URLs to be relative to content root
1013
relativeURLs: false
@@ -35,7 +38,12 @@ enableMissingTranslationPlaceholders: true
3538
disableKinds:
3639
- taxonomy
3740
- term
38-
- RSS
41+
42+
outputs:
43+
home:
44+
- HTML
45+
section:
46+
- HTML
3947

4048
# Code Highlighting configuration
4149
# Not Used. Code highlighting is controlled using the highlighting

content/en/project/_index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Title: The Medley Interlisp Project
33
weight: 2
44
type: docs
5+
outputs:
6+
- html
7+
- rss
58
aliases:
69
- /hugo/
710
- /medley/project/

content/en/software/_index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
title: Software
33
type: docs
4+
outputs:
5+
- html
6+
- rss
47
aliases:
58

69
---

layouts/_default/rss.xml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{- $authorName := "" }}
2+
{{- with .Site.Params.author }}
3+
{{- if reflect.IsMap . }}
4+
{{- with .name }}
5+
{{- $authorName = . }}
6+
{{- end }}
7+
{{- else }}
8+
{{- $authorName = . }}
9+
{{- end }}
10+
{{- end }}
11+
12+
{{- $pctx := . }}
13+
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
14+
15+
{{- $pages := slice }}
16+
{{- $mainPages := where .Pages "Kind" "in" (slice "page" "section") }}
17+
{{- $pages = $pages | union $mainPages }}
18+
19+
{{- range .Sections }}
20+
{{- $sectionPages := where .Pages "Kind" "in" (slice "page" "section") }}
21+
{{- $pages = $pages | union $sectionPages }}
22+
{{- range .Sections }}
23+
{{- $subSectionPages := where .Pages "Kind" "in" (slice "page" "section") }}
24+
{{- $pages = $pages | union $subSectionPages }}
25+
{{- end }}
26+
{{- end }}
27+
28+
{{- $limit := .Site.Config.Services.RSS.Limit }}
29+
{{- if ge $limit 1 }}
30+
{{- $pages = $pages | first $limit }}
31+
{{- end }}
32+
33+
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
34+
<channel>
35+
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
36+
<link>{{ .Permalink }}</link>
37+
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
38+
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
39+
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
40+
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
41+
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
42+
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
43+
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
44+
{{ with .OutputFormats.Get "RSS" }}
45+
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
46+
{{ end }}
47+
{{ range $pages }}
48+
<item>
49+
<title>{{ .Title }}</title>
50+
<link>{{ .Permalink }}</link>
51+
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
52+
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
53+
<guid>{{ .Permalink }}</guid>
54+
<description>{{ .Summary | html }}</description>
55+
{{ range .Params.tags }}
56+
<category>{{ . }}</category>
57+
{{ end }}
58+
</item>
59+
{{ end }}
60+
</channel>
61+
</rss>

0 commit comments

Comments
 (0)