Something went wrong. Try again.
My blog and portfolio (mirror of https://git.skye.codes/skyecodes/website) skye.codes
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031import rss from "@astrojs/rss";import {getCollection} from "astro:content";import {HOME} from "../consts.ts";
type Context = { site: string}
export async function GET(context: Context) { const blog = (await getCollection("blog")) .filter(post => !post.data.draft);
const projects = (await getCollection("projects")) .filter(project => !project.data.draft);
const items = [...blog, ...projects] .sort((a, b) => new Date(b.data.date).valueOf() - new Date(a.data.date).valueOf());
return rss({ title: HOME.TITLE, description: HOME.DESCRIPTION, site: context.site, items: items.map((item) => ({ title: item.data.title, description: item.data.description, pubDate: item.data.date, link: `/${item.collection}/${item.id}`, })), });}