diff --git a/category-feed-json.njk b/category-feed-json.njk index 7036984..c684207 100644 --- a/category-feed-json.njk +++ b/category-feed-json.njk @@ -56,7 +56,7 @@ permalink: "categories/{{ categoryFeed.slug }}/feed.json" "content_html": {{ post.content | htmlToAbsoluteUrls(absolutePostUrl) | jsonEncode | safe }}, "content_text": {{ post.content | striptags | jsonEncode | safe }}, "date_published": "{{ post.date | dateToRfc3339 }}", - "date_modified": "{{ (post.data.updated or post.date) | dateToRfc3339 }}" + "date_modified": "{{ (post.data.updated or post.date) | toDate | dateToRfc3339 }}" {%- if postImage and postImage != "" and (postImage | length) > 10 %}, "image": "{{ postImage | url | absoluteUrl(site.url) }}" {%- endif %} diff --git a/eleventy.config.js b/eleventy.config.js index 4bbc3da..3bc9028 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -291,6 +291,13 @@ export default function (eleventyConfig) { return pluginRss.dateToRfc2822(date); }); + // Coerce a value to a Date object (handles ISO strings from frontmatter like `updated:`) + eleventyConfig.addFilter("toDate", (value) => { + if (!value) return null; + if (value instanceof Date) return value; + return new Date(value); + }); + // Embed Everything - auto-embed YouTube, Vimeo, Bluesky, Mastodon, etc. // YouTube uses lite-yt-embed facade: shows thumbnail + play button, // only loads full iframe on click (~800 KiB savings). diff --git a/feed-json.njk b/feed-json.njk index 9ebdaad..9b13d3e 100644 --- a/feed-json.njk +++ b/feed-json.njk @@ -54,7 +54,7 @@ eleventyImport: "content_html": {{ (post.content | htmlToAbsoluteUrls(absolutePostUrl) + _jsonPixel) | jsonEncode | safe }}, "content_text": {{ post.content | striptags | jsonEncode | safe }}, "date_published": "{{ post.date | dateToRfc3339 }}", - "date_modified": "{{ (post.data.updated or post.date) | dateToRfc3339 }}" + "date_modified": "{{ (post.data.updated or post.date) | toDate | dateToRfc3339 }}" {%- if postImage and postImage != "" and (postImage | length) > 10 %}, "image": "{{ postImage | url | absoluteUrl(site.url) }}" {%- endif %}