Add RSS feed, add links for direct md editing on GitHub and update favicon

This commit is contained in:
thiloho
2025-04-26 22:48:37 +02:00
parent c06006d24b
commit 480ddd1e68
24 changed files with 484 additions and 23 deletions

23
src/pages/rss.xml.js Normal file
View File

@@ -0,0 +1,23 @@
import rss from "@astrojs/rss";
import { getCollection } from "astro:content";
import sanitizeHtml from "sanitize-html";
import MarkdownIt from "markdown-it";
const parser = new MarkdownIt();
export const GET = async (context) => {
const blog = await getCollection("blog");
return rss({
title: "Thilo Hohlts Blog",
description: "Thilo Hohlts Blog",
site: context.site,
trailingSlash: false,
stylesheet: "pretty-feed-v3.xsl",
items: blog.map((article) => ({
link: `/blog/${article.id}/`,
content: sanitizeHtml(parser.render(article.body), {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(["img"]),
}),
...article.data,
})),
});
};