1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 17:30:28 -04:00
jarv.is/pages/feed.atom.ts
2021-12-30 08:18:41 -05:00

25 lines
597 B
TypeScript

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/atom+xml");
res.write(feed.atom1());
res.end();
}
return {
props: {},
};
};
const AtomPage = () => null;
export default AtomPage;