Extract logic

This commit is contained in:
Marcus Blättermann 2022-11-16 20:48:13 +01:00
parent 6fa2bf2fff
commit dcf8455f77
No known key found for this signature in database
GPG Key ID: A1E1F04008AC450D

View File

@ -54,9 +54,8 @@ export const getStaticProps: GetStaticProps<PropsPage, ParsedUrlQuery> = async (
if (!args.params) { if (!args.params) {
return { notFound: true } return { notFound: true }
} }
return {
props: { const mdx = await serialize(
mdx: await serialize(
fs.readFileSync(`${path.join('docs', ...args.params.listPathPage)}.mdx`, 'utf-8'), fs.readFileSync(`${path.join('docs', ...args.params.listPathPage)}.mdx`, 'utf-8'),
{ {
parseFrontmatter: true, parseFrontmatter: true,
@ -64,7 +63,11 @@ export const getStaticProps: GetStaticProps<PropsPage, ParsedUrlQuery> = async (
remarkPlugins, remarkPlugins,
}, },
} }
), )
return {
props: {
mdx,
}, },
} }
} }