mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-12 01:20:35 +03:00
Extract function
This will make the next commit easier to read
This commit is contained in:
parent
aea5496788
commit
4151870c9f
|
@ -25,12 +25,18 @@ type ParsedUrlQuery = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getStaticPaths: GetStaticPaths<ParsedUrlQuery> = async () => {
|
export const getStaticPaths: GetStaticPaths<ParsedUrlQuery> = async () => {
|
||||||
return {
|
// This function needs to be defined inside `getStaticPath` to be executed in executed in the correct context
|
||||||
paths: fs.readdirSync(path.join('docs')).map((filename) => ({
|
const loadFolder = (): Array<{ params: ParsedUrlQuery }> =>
|
||||||
|
fs
|
||||||
|
.readdirSync(path.join('docs'))
|
||||||
|
.map((filename) => ({
|
||||||
params: {
|
params: {
|
||||||
slug: filename.replace('.mdx', ''),
|
slug: filename.replace('.mdx', ''),
|
||||||
},
|
},
|
||||||
})),
|
}))
|
||||||
|
|
||||||
|
return {
|
||||||
|
paths: loadFolder(),
|
||||||
fallback: false,
|
fallback: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user