MCPcopy Create free account
hub / github.com/api-platform/website / getEventContent

Function getEventContent

pwa/api/events.ts:51–77  ·  view source on GitHub ↗
(slug: string)

Source from the content-addressed store, hash-verified

49}
50
51export async function getEventContent(slug: string): Promise<EventWithContent> {
52 const fullPath = path.join(process.cwd(), `data/events/${slug}.mdx`);
53
54 const [fileContents, resultMdx] = await Promise.all([
55 readFile(fullPath, "utf8"),
56 import(`data/events/${slug}.mdx`),
57 ]);
58
59 const title = extractTitleFromMarkdown(fileContents) || slug;
60
61 const speakers = resultMdx.meta.speakers
62 ? await Promise.all(
63 resultMdx.meta.speakers?.map(async (speaker: { github?: string }) =>
64 speaker.github
65 ? { ...speaker, link: await getSpeakerLink(speaker.github) }
66 : speaker
67 )
68 )
69 : [];
70
71 return {
72 ...resultMdx.meta,
73 title,
74 Mdx: resultMdx.default,
75 speakers,
76 };
77}

Callers 2

generateMetadataFunction · 0.90
PageFunction · 0.90

Calls 3

extractTitleFromMarkdownFunction · 0.90
readFileFunction · 0.85
getSpeakerLinkFunction · 0.85

Tested by

no test coverage detected