From 0535960a7dd37ebf355e44d8819c651c70ffb11f Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Fri, 9 Oct 2026 02:54:30 +0800 Subject: Add RSS feed for technical note updates Signed-off-by: Richard Qin --- README.md | 12 ------------ content/notes/_index.md | 1 + layouts/baseof.html | 3 +++ layouts/notes/list.html | 1 + layouts/notes/list.rss.xml | 39 +++++++++++++++++++++++++++++++++++++++ layouts/partials/footer.html | 4 +++- 6 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 layouts/notes/list.rss.xml diff --git a/README.md b/README.md index 11051c4..750c513 100644 --- a/README.md +++ b/README.md @@ -20,18 +20,6 @@ make clean The source repository URL, per-file Git base URL, and public email are configured once in `hugo.toml`. -## Announcements - -Announcements are separate from journal entries and technical notes. The home page shows the latest three notices above RECENT, with the full archive at `/announcements/`. Announcements and journal entries share `/rss.xml`; RECENT continues to show only journal entries and notes. - -Create a notice with: - -```sh -hugo new content --kind announcement announcements/your-announcement/index.md -``` - -Set the title and `created` publication date, keep `updated` current when editing, and write the notice in the generated Markdown file. The home page limit is configured by `params.announcementLimit` in `hugo.toml`. - ## Licensing Site code and templates are licensed under `GPL-3.0-or-later`; see `COPYING`. diff --git a/content/notes/_index.md b/content/notes/_index.md index f7b6b8e..96be96a 100644 --- a/content/notes/_index.md +++ b/content/notes/_index.md @@ -2,6 +2,7 @@ title: "NOTES" lang: en url: "/notes/" +outputs: [HTML, RSS] description: "Topical documents maintained over time." license: CC-BY-SA-4.0 --- diff --git a/layouts/baseof.html b/layouts/baseof.html index 83a567e..1aa92bb 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -10,6 +10,9 @@ + {{- if eq .Section "notes" }} + + {{- end }} diff --git a/layouts/notes/list.html b/layouts/notes/list.html index a8411e1..2bd8c67 100644 --- a/layouts/notes/list.html +++ b/layouts/notes/list.html @@ -7,6 +7,7 @@ {{ .Content }} {{- if $isNotesRoot }} +

Subscribe to notes updates

{{- with .RegularPages.ByTitle }}

STANDALONE NOTES

diff --git a/layouts/notes/list.rss.xml b/layouts/notes/list.rss.xml new file mode 100644 index 0000000..6125ac4 --- /dev/null +++ b/layouts/notes/list.rss.xml @@ -0,0 +1,39 @@ +{{- $items := slice -}} +{{- range where site.RegularPages "Section" "notes" -}} + {{- if not .Params.updated -}} + {{- errorf "Missing required updated date in %s" .File.Path -}} + {{- end -}} + {{- $sortKey := printf "%s|%s" (.Lastmod.Format "2006-01-02T15:04:05-0700") .RelPermalink -}} + {{- $items = $items | append (dict "page" . "sortKey" $sortKey) -}} +{{- end -}} +{{- $items = sort $items "sortKey" "desc" -}} +{{ printf "" | safeHTML }} + + + {{ site.Params.owner }} — Notes Updates + {{ .Permalink }} + New and substantially revised technical notes by {{ site.Params.owner }}. + + {{- with $items }} + {{ (index . 0).page.Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" }} + {{- end }} + {{- range $items }} + {{- $page := .page -}} + {{- $title := $page.Title -}} + {{- if $page.Params.series -}} + {{- $title = printf "%s — %s" $page.Parent.Title $page.Title -}} + {{- end -}} + {{- $summary := $page.Plain | strings.Truncate 200 -}} + {{- with $page.Params.description -}} + {{- $summary = . | plainify -}} + {{- end -}} + + {{ $title }} + {{ $page.Permalink }} + {{ printf "%s#updated-%s" $page.Permalink ($page.Lastmod.Format "2006-01-02") }} + {{ $page.Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" }} + {{ $summary }} + + {{- end }} + + diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index ac89098..b7a9b98 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,6 +1,8 @@