mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
31 lines
787 B
TypeScript
31 lines
787 B
TypeScript
import type { Config } from '@react-router/dev/config';
|
|
import { glob } from 'node:fs/promises';
|
|
import { createGetUrl, getSlugs } from '@hanzo/docs-core/source';
|
|
import { getPageImagePath } from './app/lib/og';
|
|
|
|
const getUrl = createGetUrl('/docs');
|
|
|
|
export default {
|
|
ssr: true,
|
|
future: {
|
|
v8_middleware: true,
|
|
},
|
|
async prerender({ getStaticPaths }) {
|
|
const paths: string[] = [];
|
|
const excluded: string[] = ['/v1/search'];
|
|
|
|
for (const path of getStaticPaths()) {
|
|
if (!excluded.includes(path)) paths.push(path);
|
|
}
|
|
|
|
for await (const entry of glob('**/*.mdx', { cwd: 'content/docs' })) {
|
|
const slugs = getSlugs(entry);
|
|
|
|
paths.push(getUrl(slugs));
|
|
paths.push(getPageImagePath(slugs));
|
|
}
|
|
|
|
return paths;
|
|
},
|
|
} satisfies Config;
|