initial: Astro port of Hype404 with favicon + SEO redirects
This commit is contained in:
18
src/pages/rss.xml.js
Normal file
18
src/pages/rss.xml.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import rss from '@astrojs/rss';
|
||||
import { site } from '../lib/site.js';
|
||||
import { getAllPosts, renderMarkdown, getExcerpt } from '../lib/markdown.js';
|
||||
|
||||
export function GET(context) {
|
||||
const posts = getAllPosts().slice(0, 20);
|
||||
return rss({
|
||||
title: site.name,
|
||||
description: site.description,
|
||||
site: context.site ?? site.url,
|
||||
items: posts.map((post) => ({
|
||||
title: post.title,
|
||||
pubDate: new Date(post.date),
|
||||
description: getExcerpt(post.body, 300),
|
||||
link: `/${post.slug}/`,
|
||||
})),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user