1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 12:36:20 -04:00
jarv.is/pages/feed.xml.ts

22 lines
546 B
TypeScript

import { getAllNotes } from "../lib/parse-notes";
import { buildFeed } from "../lib/build-feed";
import type { GetServerSideProps } from "next";
export const getServerSideProps: GetServerSideProps = async (context) => {
const notes = getAllNotes(["title", "date", "image", "slug", "description"]);
const feed = buildFeed(notes);
const { res } = context;
res.setHeader("content-type", "application/rss+xml");
res.write(feed.rss2());
res.end();
return {
props: {},
};
};
const RssPage = () => null;
export default RssPage;