website/src/pages/feed.xml.ts
lew 8a9c56c3d5 flatten monorepo, migrate off Vercel
- Remove penfield (split to own repo on Forgejo)
- Move www/ contents to root, rename to wynne.rs
- Swap @astrojs/vercel for @astrojs/node, upgrade to Astro 6
- Remove auth-astro/GitHub OAuth (TinyAuth at proxy layer)
- Remove Vercel deploy webhook
- Switch to local SQLite DB (drop Turso)
- Update generate-stats.js for new build output paths
2026-04-05 01:04:11 +01:00

33 lines
986 B
TypeScript

import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import type { APIContext } from 'astro';
import { getSlug, type Post } from '../lib/posts';
import { getTxtFiles } from '../lib/txt';
import { excerpt } from '../lib/format';
export async function GET(context: APIContext) {
const posts = await getCollection('posts');
const txtFiles = getTxtFiles();
const items = [
...posts.map(post => ({
title: post.data.title,
pubDate: post.data.date,
link: `/${getSlug(post.id)}`,
description: excerpt((post as Post).body) || post.data.title,
})),
...txtFiles.map(txt => ({
title: txt.name,
pubDate: txt.date,
link: `/${txt.name}`,
description: txt.description || txt.name,
})),
].sort((a, b) => b.pubDate.getTime() - a.pubDate.getTime());
return rss({
title: 'wynne.rs',
description: 'personal website of lewis m.w.',
site: context.site ?? 'https://wynne.rs',
items,
});
}