diff options
| author | 2026-01-21 11:03:03 +0800 | |
|---|---|---|
| committer | 2026-01-21 11:03:03 +0800 | |
| commit | c792c62c86e4d9f4de8402610bb63000cd79bc3a (patch) | |
| tree | c9efcc2e994d4242cd883317c4f8737d8a821600 /packages/docs/react-router.config.ts | |
| parent | c281777d65c4207d2fc3805a52fbc6e1939f4909 (diff) | |
| download | DropOut-c792c62c86e4d9f4de8402610bb63000cd79bc3a.tar.gz DropOut-c792c62c86e4d9f4de8402610bb63000cd79bc3a.zip | |
feat(docs): add React Router docs with Fumadocs
Diffstat (limited to 'packages/docs/react-router.config.ts')
| -rw-r--r-- | packages/docs/react-router.config.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/docs/react-router.config.ts b/packages/docs/react-router.config.ts new file mode 100644 index 0000000..cfcfbe4 --- /dev/null +++ b/packages/docs/react-router.config.ts @@ -0,0 +1,23 @@ +import type { Config } from '@react-router/dev/config'; +import { glob } from 'node:fs/promises'; +import { createGetUrl, getSlugs } from 'fumadocs-core/source'; + +const getUrl = createGetUrl('/docs'); + +export default { + ssr: true, + async prerender({ getStaticPaths }) { + const paths: string[] = []; + const excluded: string[] = ['/api/search']; + + for (const path of getStaticPaths()) { + if (!excluded.includes(path)) paths.push(path); + } + + for await (const entry of glob('**/*.mdx', { cwd: 'content/docs' })) { + paths.push(getUrl(getSlugs(entry))); + } + + return paths; + }, +} satisfies Config; |