mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-10-23 08:04:28 -04:00
24
pages/feed.xml.ts
Normal file
24
pages/feed.xml.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { getAllNotes } from "../lib/parseNotes";
|
||||
import { buildFeed } from "../lib/buildFeed";
|
||||
import type { GetServerSideProps } from "next";
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||
if (context && context.res) {
|
||||
const { res } = context;
|
||||
|
||||
const notes = getAllNotes(["title", "date", "image", "slug", "description"]);
|
||||
|
||||
const feed = buildFeed(notes);
|
||||
res.setHeader("content-type", "application/rss+xml");
|
||||
res.write(feed.rss2());
|
||||
res.end();
|
||||
}
|
||||
|
||||
return {
|
||||
props: {},
|
||||
};
|
||||
};
|
||||
|
||||
const RssPage = () => null;
|
||||
|
||||
export default RssPage;
|
Reference in New Issue
Block a user