Update RSS elements and TOC svg

This commit is contained in:
thiloho
2025-04-27 00:01:26 +02:00
parent 480ddd1e68
commit 89e5dbf5ec
6 changed files with 32 additions and 158 deletions

View File

@@ -6,12 +6,24 @@ const parser = new MarkdownIt();
export const GET = async (context) => {
const blog = await getCollection("blog");
const latestModDate = blog.reduce((latest, article) => {
const modDate = article.data.modDate || article.data.pubDate;
return modDate > latest ? modDate : latest;
}, new Date(0));
return rss({
title: "Thilo Hohlts Blog",
description: "Thilo Hohlts Blog",
title: "Thilo Hohlt's Blog",
description: "Thilo Hohlt's Blog",
site: context.site,
trailingSlash: false,
stylesheet: "pretty-feed-v3.xsl",
xmlns: {
atom: "http://www.w3.org/2005/Atom",
},
customData: `
<lastBuildDate>${latestModDate.toUTCString()}</lastBuildDate>
<atom:link href="${context.site}rss.xml" rel="self" type="application/rss+xml" />
`,
items: blog.map((article) => ({
link: `/blog/${article.id}/`,
content: sanitizeHtml(parser.render(article.body), {