- Notifications
You must be signed in to change notification settings - Fork 10
Add support for RSS Feed#258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
6 commits Select commit Hold shift + click to select a range
4a7fb7f
Add Title to hugo.yaml and modify navbar to use it
stumbo 167bf74
Add RSS Feed to History, Software and Project pages.
stumbo d91b494
Merge branch 'addTitleToMenuBar' into rssFeed
stumbo df65935
Add rss Feed to Footer
stumbo 096ac7b
Update config files to rename RSS Feed to rss.xml
stumbo a17d408
Update title and description lines
stumbo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{{- $authorName := "" }} | ||
{{- with .Site.Params.author }} | ||
{{- if reflect.IsMap . }} | ||
{{- with .name }} | ||
{{- $authorName = . }} | ||
{{- end }} | ||
{{- else }} | ||
{{- $authorName = . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- $pctx := . }} | ||
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }} | ||
<!-- Iterate through all sections and include both sections and | ||
pages in the rss feed. The default rss.xml only includes | ||
pages. --> | ||
{{- $pages := slice }} | ||
{{- $mainPages := where .Pages "Kind" "in" (slice "page" "section") }} | ||
{{- $pages = $pages | union $mainPages }} | ||
{{- range .Sections }} | ||
{{- $sectionPages := where .Pages "Kind" "in" (slice "page" "section") }} | ||
{{- $pages = $pages | union $sectionPages }} | ||
{{- range .Sections }} | ||
{{- $subSectionPages := where .Pages "Kind" "in" (slice "page" "section") }} | ||
{{- $pages = $pages | union $subSectionPages }} | ||
{{- end }} | ||
{{- end }} | ||
{{- $limit := .Site.Config.Services.RSS.Limit }} | ||
{{- if ge $limit 1 }} | ||
{{- $pages = $pages | first $limit }} | ||
{{- end }} | ||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> | ||
<channel> | ||
<title>Updates from the Medley Interlisp Project</title> | ||
<link>{{ .Permalink }}</link> | ||
<description>Updates from the Medley Interlisp Project</description> | ||
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} | ||
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }} | ||
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} | ||
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} | ||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} | ||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} | ||
{{ with .OutputFormats.Get "RSS" }} | ||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} | ||
{{ end }} | ||
{{ range $pages }} | ||
<item> | ||
<title>{{ .Title }}</title> | ||
<link>{{ .Permalink }}</link> | ||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> | ||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} | ||
<guid>{{ .Permalink }}</guid> | ||
<description>{{ .Summary | html }}</description> | ||
{{ range .Params.tags }} | ||
<category>{{ . }}</category> | ||
{{ end }} | ||
</item> | ||
{{ end }} | ||
</channel> | ||
</rss> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<ul class="td-footer__links-list"> | ||
{{ range . }} | ||
{{ if eq .name "RSS Feed" }} | ||
<li class="td-footer__links-item" data-bs-toggle="tooltip" title="RSS" aria-label="RSS"> | ||
<a target="_blank" rel="noopener" href="{{ absURL .url }}" aria-label="RSS"> | ||
<i class="fas fa-rss"></i> | ||
</a> | ||
</li> | ||
{{ else }} | ||
<li class="td-footer__links-item" data-bs-toggle="tooltip" title="{{ .name }}" aria-label="{{ .name }}"> | ||
<a target="_blank" rel="noopener" href="{{ .url }}" aria-label="{{ .name }}"> | ||
<i class="{{ .icon }}"></i> | ||
</a> | ||
{{ end }} | ||
{{ end }} | ||
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{{ $cover := and | ||
(.HasShortcode "blocks/cover") | ||
(not .Site.Params.ui.navbar_translucent_over_cover_disable) | ||
-}} | ||
{{ $baseURL := urls.Parse $.Site.Params.Baseurl -}} | ||
<nav class="td-navbar js-navbar-scroll | ||
{{- if $cover }} td-navbar-cover {{- end }}" data-bs-theme="dark"> | ||
<div class="container-fluid flex-column flex-md-row"> | ||
<a class="navbar-brand" href="{{ .Site.Home.RelPermalink }}"> | ||
{{- /**/ -}} | ||
<span class="navbar-brand__logo navbar-logo"> | ||
{{- if ne .Site.Params.ui.navbar_logo false -}} | ||
{{ with resources.Get "icons/logo.svg" -}} | ||
{{ ( . | minify).Content | safeHTML -}} | ||
{{ end -}} | ||
{{ end -}} | ||
</span> | ||
{{- /**/ -}} | ||
<span class="navbar-brand__name"> | ||
<!-- Place the site title on every page header, except the home page --> | ||
{{ if not .IsHome }} | ||
{{ .Site.Title }} | ||
{{ end }} | ||
</span> | ||
{{- /**/ -}} | ||
</a> | ||
<div class="td-navbar-nav-scroll ms-md-auto" id="main_navbar"> | ||
<ul class="navbar-nav"> | ||
{{ $p := . -}} | ||
{{ range .Site.Menus.main -}} | ||
<li class="nav-item"> | ||
{{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}} | ||
{{ $href := "" -}} | ||
{{ with .Page -}} | ||
{{ $active = or $active ( $.IsDescendant .) -}} | ||
{{ $href = .RelPermalink -}} | ||
{{ else -}} | ||
{{ $href = .URL | relLangURL -}} | ||
{{ end -}} | ||
{{ $isExternal := ne $baseURL.Host (urls.Parse .URL).Host -}} | ||
<a {{/**/ -}} | ||
class="nav-link {{- if $active }} active {{- end }}" {{/**/ -}} | ||
href="{{ $href }}" | ||
{{- if $isExternal }} target="_blank" rel="noopener" {{- end -}} | ||
> | ||
{{- .Pre -}} | ||
<span>{{ .Name }}</span> | ||
{{- .Post -}} | ||
</a> | ||
</li> | ||
{{ end -}} | ||
{{ if .Site.Params.versions -}} | ||
<li class="nav-item dropdown d-none d-lg-block"> | ||
{{ partial "navbar-version-selector.html" . -}} | ||
</li> | ||
{{ end -}} | ||
{{ if (gt (len .Site.Home.Translations) 0) -}} | ||
<li class="nav-item dropdown d-none d-lg-block"> | ||
{{ partial "navbar-lang-selector.html" . -}} | ||
</li> | ||
{{ end -}} | ||
{{ if .Site.Params.ui.showLightDarkModeMenu -}} | ||
<li class="td-light-dark-menu nav-item dropdown"> | ||
{{ partial "theme-toggler" . }} | ||
</li> | ||
{{ end -}} | ||
</ul> | ||
</div> | ||
<div class="d-none d-lg-block"> | ||
{{ partial "search-input.html" . }} | ||
</div> | ||
</div> | ||
</nav> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{ if and .GitInfo .Site.Params.github_repo -}} | ||
<div class="td-page-meta__lastmod"> | ||
<!-- | ||
Disable showing of Git Commit info in the footer | ||
{{ T "post_last_mod" }} {{ .Lastmod.Format .Site.Params.time_format_default -}} | ||
{{ with .GitInfo }}: {{/* Trim WS */ -}} | ||
<a data-proofer-ignore href="{{ $.Site.Params.github_repo }}/commit/{{ .Hash }}"> | ||
{{- .Subject }} ({{ .AbbreviatedHash }}) {{- /* Trim WS */ -}} | ||
</a> | ||
{{- end }} | ||
--> | ||
</div> | ||
{{ end -}} |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, Hugo makes you do to a lot of work to produce an RSS feed for a given page.
Two questions:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the feed's title and description are kind of phrased oddly.
Title:
News and Status Reports on The Medley Interlisp Project
Description:
Recent content in News and Status Reports on The Medley Interlisp Project
Looking at the Hugo configuration, I couldn't figure out a way to override these. They're not directly derived from the page title, which is
News and Status Reports | The Medley Interlisp Project
.I'd love it if the RSS feed's title and description were both
Updates from the Medley Interlisp Project
, or maybeMedley Interlisp Project: Latest News
, or something like that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding additional RSS Feeds is straight forward. It only requires an addition to the front matter of the page where we want to add it. See
content/en/project/status/_index.md
the following lines turn rss on for that page:Any page whose front matter has those lines, will generate an rss feed.
One thing we should then consider, do we want the feed in the footer to reflect the root of our site? Or, do we want it to remain the /project/status/rss.xml feed? And, if that is the case, how do we make users aware of other potential locations where feeds are available?
Making the footer feed vary by page would be confusing to users, that link should be stable. Adding another RSS Feed link on pages that supports feed might also be confusing. Identical icons in different places on the page that have different behaviors, one whose behavior varies by page.
The answer to your second question is yes, I'll push an update to this PR that supports renaming the feed from
index.xml
torss.xml
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Page Title and Description are generated in
layouts/_default/rss.xml
.I can modify the phrasing to be more in line with your ask.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. We need to get in the practice of updating the project/status page whenever we make a substantive change to the site, so having project/statusgenerate the site-wide RSS feed would be fine, at least for now.
If we want individual per-page feeds in the future, we can figure out a place for those icons on the specific pages.
Let's start out with a single feed, visible site-wide, that contains updates to the project/status page.