mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-09 22:54:53 +03:00
Extract logic
This commit is contained in:
parent
84f8b2fcbd
commit
9d9f5cc8ba
|
@ -50,22 +50,26 @@ export const getStaticPaths: GetStaticPaths<ParsedUrlQuery> = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPathFull = (slug: ReadonlyArray<string>): ReadonlyArray<string> => slug
|
||||||
|
|
||||||
export const getStaticProps: GetStaticProps<PropsPage, ParsedUrlQuery> = async (args) => {
|
export const getStaticProps: GetStaticProps<PropsPage, ParsedUrlQuery> = async (args) => {
|
||||||
if (!args.params) {
|
if (!args.params) {
|
||||||
return { notFound: true }
|
return { notFound: true }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pathFull = getPathFull(args.params.slug)
|
||||||
|
|
||||||
|
const mdx = await serialize(fs.readFileSync(`${path.join('docs', ...pathFull)}.mdx`, 'utf-8'), {
|
||||||
|
parseFrontmatter: true,
|
||||||
|
mdxOptions: {
|
||||||
|
remarkPlugins,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
slug: args.params.slug,
|
slug: args.params.slug,
|
||||||
mdx: await serialize(
|
mdx,
|
||||||
fs.readFileSync(`${path.join('docs', ...args.params.slug)}.mdx`, 'utf-8'),
|
|
||||||
{
|
|
||||||
parseFrontmatter: true,
|
|
||||||
mdxOptions: {
|
|
||||||
remarkPlugins,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user