From dcf8455f778905b1c3db030b7eb4b1e005a2a0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Bl=C3=A4ttermann?= Date: Wed, 16 Nov 2022 20:48:13 +0100 Subject: [PATCH] Extract logic --- website/pages/[...listPathPage].tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/website/pages/[...listPathPage].tsx b/website/pages/[...listPathPage].tsx index 7860e2135..af59e6946 100644 --- a/website/pages/[...listPathPage].tsx +++ b/website/pages/[...listPathPage].tsx @@ -54,17 +54,20 @@ export const getStaticProps: GetStaticProps = async ( if (!args.params) { return { notFound: true } } + + const mdx = await serialize( + fs.readFileSync(`${path.join('docs', ...args.params.listPathPage)}.mdx`, 'utf-8'), + { + parseFrontmatter: true, + mdxOptions: { + remarkPlugins, + }, + } + ) + return { props: { - mdx: await serialize( - fs.readFileSync(`${path.join('docs', ...args.params.listPathPage)}.mdx`, 'utf-8'), - { - parseFrontmatter: true, - mdxOptions: { - remarkPlugins, - }, - } - ), + mdx, }, } }