Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,18 @@ eleventyExcludeFromCollections: true
<link href="{{ site.url }}/atom.xml" rel="self"/>
<link href="{{ site.url }}"/>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ site.url }}</id>
<id>{{ site.url }}/</id>
<author>
<name>{{ site.author.name }}</name>
<email>{{ site.author.email }} </email>
<email>{{ site.author.email }}</email>
</author>
{% for post in collections.posts %}
<entry>
<title>{{ post.data.title | xml_escape }}</title>
<link href="{{ site.url }}{{ post.url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}{{ post.id }}</id>
<content type="html" xml:base="{{ site.url }}{{ post.url }}"><![CDATA[
{{ post.content | xml_escape }}
]]></content>
<id>{{ site.url }}{{ post.url }}</id>
<content type="html"><![CDATA[{{ post.content }}]]></content>
</entry>
{% endfor %}
</feed>
15 changes: 15 additions & 0 deletions eleventy.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&apos;");
});

let markdownLib = markdownIt({ html: true, linkify: true }).use(
markdownItAttrs,
{
Expand Down