Claude improvements

This commit is contained in:
Andras Schmelczer 2026-05-11 07:48:33 +01:00
parent a86940da30
commit df2267a968
79 changed files with 2695 additions and 1162 deletions

View file

@ -1,23 +1,38 @@
import rss from '@astrojs/rss';
import type { APIRoute } from 'astro';
import { articlePath, getPublishedPosts, site } from '../lib/site';
import { absoluteUrl, articlePath, getPublishedPosts, site } from '../lib/site';
export const GET: APIRoute = async (context) => {
const posts = await getPublishedPosts();
const feedUrl = absoluteUrl('/rss.xml');
return rss({
title: site.name,
description: site.description,
site: context.site ?? site.url,
items: posts.map((post) => ({
title: post.data.title,
description: post.data.description,
pubDate: post.data.date,
link: articlePath(post),
categories: post.data.tags,
customData: post.data.updated
? `<updated>${post.data.updated.toISOString()}</updated>`
: undefined,
})),
xmlns: {
atom: 'http://www.w3.org/2005/Atom',
content: 'http://purl.org/rss/1.0/modules/content/',
},
customData: [
'<language>en-us</language>',
`<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>`,
`<atom:link href="${feedUrl}" rel="self" type="application/rss+xml" />`,
].join('\n'),
items: posts.map((post) => {
const url = absoluteUrl(articlePath(post));
const updated = post.data.updated
? `<atom:updated>${post.data.updated.toISOString()}</atom:updated>`
: '';
return {
title: post.data.title,
description: post.data.description,
pubDate: post.data.date,
link: url,
author: `${site.email} (${site.name})`,
categories: [...post.data.tags],
customData: `<guid isPermaLink="true">${url}</guid>${updated}`,
};
}),
});
};