From 298fa4f42d7f94591ef0714a85f6394889d078d1 Mon Sep 17 00:00:00 2001 From: Gordon Pedersen Date: Tue, 3 Oct 2023 09:19:23 +1100 Subject: [PATCH] Fixes to the rss/atom/json feeds --- .eleventy.js | 2 ++ _content/atom.njk | 7 +++---- _content/json.njk | 6 +++--- _content/rss.njk | 2 +- bun.lockb | Bin 80379 -> 80379 bytes 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index fd0b7e6..35e3615 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -62,6 +62,8 @@ function addShortcodes(eleventyConfig) { function addFilters(eleventyConfig) { eleventyConfig.addFilter("formatDate", formatDateFilter) eleventyConfig.addFilter("dateISOString", dateISOStringFilter) + eleventyConfig.addFilter("dateObj", (value) => new Date(value)) + eleventyConfig.addFilter("log", (value) => { console.log(`[11ty] 📄LOG: `, value); return value }) eleventyConfig.addFilter("concat", (value, other) => value + '' + other) eleventyConfig.addNunjucksAsyncFilter("await", (promise) => promise.then(res => callback(null, res)).catch(err => callback(err))) } diff --git a/_content/atom.njk b/_content/atom.njk index 1712210..e053b60 100644 --- a/_content/atom.njk +++ b/_content/atom.njk @@ -15,9 +15,8 @@ {{ ACTOR.name }}'s feed {{ metadata.subtitle }} - - {{ collections.feed[0].date | dateToRfc822 }} - {{ ACTOR.url }} + {{ collections.feed[0].date | dateToRfc3339 }} + {{ ACTOR.id | absoluteUrl(ACTOR.url) }} {{ ACTOR.name }} @@ -26,7 +25,7 @@ {{ post.data.title }} - {{ post.date | dateToRfc822 }} + {{ post.data.published | dateObj | dateToRfc3339 }} {{ absolutePostUrl }} {{ summaryMacro(post.data, post.url) | htmlToAbsoluteUrls(absolutePostUrl) }} diff --git a/_content/json.njk b/_content/json.njk index e4dfd6e..623d805 100644 --- a/_content/json.njk +++ b/_content/json.njk @@ -13,12 +13,12 @@ "version": "https://jsonfeed.org/version/1.1", "title": "{{ ACTOR.name }}'s feed", "language": "{{ metadata.language }}", - "home_page_url": "{{ ACTOR.url }}", + "home_page_url": "{{ ACTOR.url }}/", "feed_url": "{{ permalink | absoluteUrl(ACTOR.url) }}", "description": "{{ metadata.subtitle }}", "author": { "name": "{{ ACTOR.name }}", - "url": "{{ ACTOR.url }}" + "url": "{{ ACTOR.url }}/" }, "items": [ {%- for post in collections.feed %} @@ -28,7 +28,7 @@ "url": "{{ absolutePostUrl }}", "title": "{{ post.data.title }}", "content_html": {{ summaryMacro(post.data, post.url) | concat(post.templateContent) | htmlToAbsoluteUrls(absolutePostUrl) | dump | safe }}, - "date_published": "{{ post.date | dateToRfc3339 }}" + "date_published": "{{ post.data.published | dateObj | dateToRfc3339 }}" } {% if not loop.last %},{% endif %} {%- endfor %} diff --git a/_content/rss.njk b/_content/rss.njk index 9945f45..115fc47 100644 --- a/_content/rss.njk +++ b/_content/rss.njk @@ -27,7 +27,7 @@ {{ summaryMacro(post.data, post.url) | htmlToAbsoluteUrls(absolutePostUrl) }} {{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }} - {{ post.date | dateToRfc822 }} + {{ post.data.published | dateObj | dateToRfc822 }} {{ ACTOR.name }} {{ absolutePostUrl }} diff --git a/bun.lockb b/bun.lockb index 1a020956feff3322b3ac7e0799aba627df06c668..941a179f4201e03bdcab96a40afd5b5bca95c2f2 100755 GIT binary patch delta 50 zcmV-20L}mV^91|z1h5zmllW0MvrrB!jsibclQ9k+ldzmLk9s~F)lJL IFtXwMSTZve5&!@I delta 86 zcmezUndSFqmJJeok{g)RcimuNU|?c^fM!Vs1}6rF2FA%B`PDZ^@Tv3(AWI7Xl}}zU VrvivYHcQNX=*$k)xar~V2mk{<7q0*S