build: 🔧 use manual feed template instead of virtual one

In order to display the title image in the feed.xml like in the posts on the website, a more customizable variant is needed.
This commit is contained in:
Sebin Nyshkim 2025-04-20 22:30:14 +02:00
parent 769063f3cd
commit 1607d31beb
2 changed files with 42 additions and 19 deletions

40
src/feed.njk Normal file
View file

@ -0,0 +1,40 @@
---json
{
"permalink": "feed.xml",
"eleventyExcludeFromCollections": true,
"metadata": {
"title": "Sebin's Blog",
"description": "Writing about stuff I have vague interests in and commenting on stuff I read.",
"language": "en",
"base": "https://blog.sebin-nyshkim.net/",
"author": {
"name": "Sebin Nyshkim"
}
}
}
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ metadata.language or page.lang }}">
<title>{{ metadata.title }}</title>
<subtitle>{{ metadata.description }}</subtitle>
<link href="{{ permalink | htmlBaseUrl(metadata.base) }}" rel="self"/>
<link href="{{ metadata.base | addPathPrefixToFullUrl }}"/>
<updated>{{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
<id>{{ metadata.base | addPathPrefixToFullUrl }}</id>
<author>
<name>{{ metadata.author.name }}</name>
</author>
{%- for post in collections.posts | reverse %}
{%- set absolutePostUrl %}{{ post.url | htmlBaseUrl(metadata.base) }}{% endset %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | dateToRfc3339 }}</updated>
<id>{{ absolutePostUrl }}</id>
<content type="html">
&lt;img src="{{ post.data.image.src }}.webp?width=1200" alt="{{ post.data.image.alt }}"&gt;
{{ post.content | renderTransforms(post.data.page, metadata.base) }}
</content>
</entry>
{%- endfor %}
</feed>