diff options
| author | Kumar Damani <me@kumardamani.net> | 2026-08-03 17:27:57 +0000 |
|---|---|---|
| committer | Kumar Damani <me@kumardamani.net> | 2026-08-03 17:27:57 +0000 |
| commit | 0c080d7c859dabc942e0fe13a1289b087e1093c8 (patch) | |
| tree | be9875313820ea5b51f473d21b541d368d262471 | |
| parent | 84aff405b134337ad335453f339f46bd86e7bf27 (diff) | |
removed rss feed in favour of atom
| -rw-r--r-- | feed.typ | 47 | ||||
| -rw-r--r-- | global/common.typ | 3 | ||||
| -rw-r--r-- | main.typ | 3 |
3 files changed, 5 insertions, 48 deletions
@@ -1,19 +1,11 @@ -// RSS 2.0 and Atom feeds for the blog posts, emitted as feed.xml and -// atom.xml by main.typ. Entries are built from the metadata in -// site-info.pages (newest first). +// Atom (RFC 4287) feed for the blog posts, emitted as atom.xml by +// main.typ. Entries are built from the metadata in site-info.pages +// (newest first). #import "/global/common.typ": baseurl #let xml-escape(s) = s.replace("&", "&").replace("<", "<").replace(">", ">") -// ISO date ("2026-07-28") to RFC 822 ("Tue, 28 Jul 2026 00:00:00 GMT"). -#let rfc822(iso) = { - let (y, m, d) = iso.split("-").map(int) - datetime(year: y, month: m, day: d).display( - "[weekday repr:short], [day] [month repr:short] [year] 00:00:00 GMT" - ) -} - // ISO date ("2026-07-28") to RFC 3339 ("2026-07-28T00:00:00Z"). #let rfc3339(iso) = iso + "T00:00:00Z" @@ -31,39 +23,6 @@ entries } -#let feed-xml(site-info) = { - let items = _entries(site-info, (title, url, p) => { - let lines = ( - " <item>", - " <title>" + xml-escape(title) + "</title>", - " <link>" + url + "</link>", - " <guid>" + url + "</guid>", - ) - if "date" in p { - lines.push(" <pubDate>" + rfc822(p.date) + "</pubDate>") - } - if "description" in p { - lines.push(" <description>" + xml-escape(p.description) + "</description>") - } - lines.push(" </item>") - lines.join("\n") - }) - - ( - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", - "<rss version=\"2.0\">", - "<channel>", - " <title>" + xml-escape(site-info.title) + "</title>", - " <link>" + baseurl + "/</link>", - " <description>Posts from " + xml-escape(site-info.title) + " (" + baseurl + ")</description>", - items.join("\n"), - "</channel>", - "</rss>", - "", - ).join("\n") -} - -// Atom (RFC 4287) feed, emitted as atom.xml by main.typ. #let atom-xml(site-info) = { let entries = _entries(site-info, (title, url, p) => { let lines = ( diff --git a/global/common.typ b/global/common.typ index 269fc62..2b8fa7e 100644 --- a/global/common.typ +++ b/global/common.typ @@ -184,7 +184,6 @@ html.link(rel: "icon", href: base + "favicon.ico") html.elem("link", attrs: (rel: "preload", href: base + "extlink.svg", "as": "image")) html.link(rel: "stylesheet", href: base + "main.css") - html.link(rel: "alternate", type: "application/rss+xml", title: site + " RSS", href: base + "feed.xml") html.link(rel: "alternate", type: "application/atom+xml", title: site + " Atom", href: base + "atom.xml") for ss in stylesheets { @@ -232,7 +231,7 @@ html.footer({ html.span(class: "updated")[\[Updated: #ci.date.\]] html.span(class: "logs")[ - \[For nerds: #extlink(srcurl)[site source], #extlink(ci.link)[logs], #link(base + "feed.xml")[rss], #link(base + "atom.xml")[atom]\] + \[For nerds: #extlink(srcurl)[site source], #extlink(ci.link)[logs], #link(base + "atom.xml")[atom]\] ] }) }) @@ -4,7 +4,7 @@ #import "/global/common.typ": * #import "/site.typ": site-info -#import "/feed.typ": feed-xml, atom-xml +#import "/feed.typ": atom-xml #import "/index.typ" as index-page #import "/software.typ" as software-page @@ -75,7 +75,6 @@ #asset("extlink.svg", read("/global/extlink.svg", encoding: none)) #asset("favicon.ico", read("/global/favicon.ico", encoding: none)) #asset("favicon.svg", read("/global/favicon.svg", encoding: none)) -#asset("feed.xml", bytes(feed-xml(site-info))) #asset("atom.xml", bytes(atom-xml(site-info))) // image assets collected from pages via the img/fig helpers |
