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) {
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)))
}

View file

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

View file

@ -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 %}

View file

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

BIN
bun.lockb

Binary file not shown.