Initial rewrite
This commit is contained in:
parent
a5f64a3ff8
commit
0d183c8335
200 changed files with 12537 additions and 18659 deletions
23
src/pages/rss.xml.ts
Normal file
23
src/pages/rss.xml.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import rss from '@astrojs/rss';
|
||||
import type { APIRoute } from 'astro';
|
||||
import { articlePath, getPublishedPosts, site } from '../lib/site';
|
||||
|
||||
export const GET: APIRoute = async (context) => {
|
||||
const posts = await getPublishedPosts();
|
||||
|
||||
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,
|
||||
})),
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue