mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-19 05:15:34 -04:00
fs
-> fs/promises
-> asyncify all note parsing
This commit is contained in:
@@ -9,11 +9,10 @@ import type { ParsedUrlQuery } from "querystring";
|
||||
|
||||
// handles literally *everything* about building the server-side rss/atom feeds and writing the response.
|
||||
// all the page needs to do is `return buildFeed(context, { format: "rss" })` from getServerSideProps.
|
||||
|
||||
export const buildFeed = (
|
||||
export const buildFeed = async (
|
||||
context: GetServerSidePropsContext<ParsedUrlQuery, PreviewData>,
|
||||
options?: { type: "rss" | "atom" }
|
||||
): { props: Record<string, unknown> } => {
|
||||
): Promise<{ props: Record<string, unknown> }> => {
|
||||
const { res } = context;
|
||||
|
||||
// https://github.com/jpmonette/feed#example
|
||||
@@ -37,7 +36,7 @@ export const buildFeed = (
|
||||
});
|
||||
|
||||
// add notes separately using their frontmatter
|
||||
const notes = getAllNotes();
|
||||
const notes = await getAllNotes();
|
||||
notes.forEach((note) => {
|
||||
feed.addItem({
|
||||
guid: note.permalink,
|
||||
|
Reference in New Issue
Block a user