|
|
|
@ -23,15 +23,14 @@ interface Metadata { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface Event { |
|
|
|
|
content: string | MDXRemoteSerializeResult<Record<string, unknown>>; |
|
|
|
|
content: MDXRemoteSerializeResult<Record<string, unknown>>; |
|
|
|
|
metadata: Metadata; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export async function getEventBySlug( |
|
|
|
|
year: string, |
|
|
|
|
term: string, |
|
|
|
|
slug: string, |
|
|
|
|
convert = true |
|
|
|
|
slug: string |
|
|
|
|
): Promise<Event> { |
|
|
|
|
const raw = await fs.readFile( |
|
|
|
|
path.join(EVENTS_PATH, year, term, `${slug}.event.md`), |
|
|
|
@ -40,7 +39,7 @@ export async function getEventBySlug( |
|
|
|
|
const { content, data: metadata } = matter(raw); |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
content: convert ? await serialize(content) : content, |
|
|
|
|
content: await serialize(content), |
|
|
|
|
metadata: metadata as Metadata, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|