From 698e257e0fea82a5776b1a2f5b543b9be7694b4a Mon Sep 17 00:00:00 2001 From: Sotiris Tsimbonis Date: Sat, 20 Dec 2025 01:49:50 +0200 Subject: [PATCH] Fix atom.xml feed errors - Add missing date_to_xmlschema and xml_escape Liquid filters - Fix invalid post.id reference (changed to post.url) - Remove redundant xml_escape from CDATA content block - Keep xml_escape for title element (required outside CDATA) --- atom.xml | 10 ++++------ eleventy.config.cjs | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/atom.xml b/atom.xml index 30e9190..92af052 100644 --- a/atom.xml +++ b/atom.xml @@ -9,20 +9,18 @@ eleventyExcludeFromCollections: true {{ site.time | date_to_xmlschema }} - {{ site.url }} + {{ site.url }}/ {{ site.author.name }} - {{ site.author.email }} + {{ site.author.email }} {% for post in collections.posts %} {{ post.data.title | xml_escape }} {{ post.date | date_to_xmlschema }} - {{ site.url }}{{ post.id }} - + {{ site.url }}{{ post.url }} + {% endfor %} diff --git a/eleventy.config.cjs b/eleventy.config.cjs index 904e830..262b446 100644 --- a/eleventy.config.cjs +++ b/eleventy.config.cjs @@ -102,6 +102,21 @@ module.exports = (eleventyConfig) => { } ); + eleventyConfig.addLiquidFilter("date_to_xmlschema", function (input) { + const date = new Date(input); + return date.toISOString(); + }); + + eleventyConfig.addLiquidFilter("xml_escape", function (input) { + if (!input) return ""; + return input + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); + }); + let markdownLib = markdownIt({ html: true, linkify: true }).use( markdownItAttrs, {