Fixes to the rss/atom/json feeds

This commit is contained in:
Gordon Pedersen 2023-10-03 09:19:23 +11:00
parent 983d828f92
commit 298fa4f42d
5 changed files with 9 additions and 8 deletions

View file

@ -62,6 +62,8 @@ function addShortcodes(eleventyConfig) {
function addFilters(eleventyConfig) { function addFilters(eleventyConfig) {
eleventyConfig.addFilter("formatDate", formatDateFilter) eleventyConfig.addFilter("formatDate", formatDateFilter)
eleventyConfig.addFilter("dateISOString", dateISOStringFilter) 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.addFilter("concat", (value, other) => value + '' + other)
eleventyConfig.addNunjucksAsyncFilter("await", (promise) => promise.then(res => callback(null, res)).catch(err => callback(err))) eleventyConfig.addNunjucksAsyncFilter("await", (promise) => promise.then(res => callback(null, res)).catch(err => callback(err)))
} }

View file

@ -15,9 +15,8 @@
<title>{{ ACTOR.name }}'s feed</title> <title>{{ ACTOR.name }}'s feed</title>
<subtitle>{{ metadata.subtitle }}</subtitle> <subtitle>{{ metadata.subtitle }}</subtitle>
<link href="{{ permalink | absoluteUrl(ACTOR.url) }}" rel="self"/> <link href="{{ permalink | absoluteUrl(ACTOR.url) }}" rel="self"/>
<link href="{{ ACTOR.url }}"/> <updated>{{ collections.feed[0].date | dateToRfc3339 }}</updated>
<updated>{{ collections.feed[0].date | dateToRfc822 }}</updated> <id>{{ ACTOR.id | absoluteUrl(ACTOR.url) }}</id>
<id>{{ ACTOR.url }}</id>
<author> <author>
<name>{{ ACTOR.name }}</name> <name>{{ ACTOR.name }}</name>
</author> </author>
@ -26,7 +25,7 @@
<entry> <entry>
<title>{{ post.data.title }}</title> <title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}"/> <link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | dateToRfc822 }}</updated> <updated>{{ post.data.published | dateObj | dateToRfc3339 }}</updated>
<id>{{ absolutePostUrl }}</id> <id>{{ absolutePostUrl }}</id>
<content xml:lang="{{ metadata.language }}" type="html"> <content xml:lang="{{ metadata.language }}" type="html">
{{ summaryMacro(post.data, post.url) | htmlToAbsoluteUrls(absolutePostUrl) }} {{ summaryMacro(post.data, post.url) | htmlToAbsoluteUrls(absolutePostUrl) }}

View file

@ -13,12 +13,12 @@
"version": "https://jsonfeed.org/version/1.1", "version": "https://jsonfeed.org/version/1.1",
"title": "{{ ACTOR.name }}'s feed", "title": "{{ ACTOR.name }}'s feed",
"language": "{{ metadata.language }}", "language": "{{ metadata.language }}",
"home_page_url": "{{ ACTOR.url }}", "home_page_url": "{{ ACTOR.url }}/",
"feed_url": "{{ permalink | absoluteUrl(ACTOR.url) }}", "feed_url": "{{ permalink | absoluteUrl(ACTOR.url) }}",
"description": "{{ metadata.subtitle }}", "description": "{{ metadata.subtitle }}",
"author": { "author": {
"name": "{{ ACTOR.name }}", "name": "{{ ACTOR.name }}",
"url": "{{ ACTOR.url }}" "url": "{{ ACTOR.url }}/"
}, },
"items": [ "items": [
{%- for post in collections.feed %} {%- for post in collections.feed %}
@ -28,7 +28,7 @@
"url": "{{ absolutePostUrl }}", "url": "{{ absolutePostUrl }}",
"title": "{{ post.data.title }}", "title": "{{ post.data.title }}",
"content_html": {{ summaryMacro(post.data, post.url) | concat(post.templateContent) | htmlToAbsoluteUrls(absolutePostUrl) | dump | safe }}, "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 %} {% if not loop.last %},{% endif %}
{%- endfor %} {%- endfor %}

View file

@ -27,7 +27,7 @@
{{ summaryMacro(post.data, post.url) | htmlToAbsoluteUrls(absolutePostUrl) }} {{ summaryMacro(post.data, post.url) | htmlToAbsoluteUrls(absolutePostUrl) }}
{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }} {{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}
</description> </description>
<pubDate>{{ post.date | dateToRfc822 }}</pubDate> <pubDate>{{ post.data.published | dateObj | dateToRfc822 }}</pubDate>
<dc:creator>{{ ACTOR.name }}</dc:creator> <dc:creator>{{ ACTOR.name }}</dc:creator>
<guid>{{ absolutePostUrl }}</guid> <guid>{{ absolutePostUrl }}</guid>
</item> </item>

BIN
bun.lockb

Binary file not shown.