Files
docs/examples/react-router/react-router.config.ts
T
Kane WangandGitHub c684f53349 feat(create-app): add OpenGraph Image to template (#3023)
* feat(create-app): add OpenGraph Image to template

* format, add `ssr.external`

* add waku, fix template margin

* add next.config.mjs patch

* rewrite takumi docs page

* fix webp suffix

* sync create-app

* sync all `getPageImage`

* remove waku `rollupOptions`

* sync

* format

* fix meta property

* fix typo

* create `fumadocs-ui/og/takumi` entry

* add util `replace`, `replaceAll`

* update fs import

* format

* only create `og.ts` for React Router

* update Waku template to use source.ts
2026-02-22 16:49:24 +08:00

31 lines
785 B
TypeScript

import type { Config } from '@react-router/dev/config';
import { glob } from 'node:fs/promises';
import { createGetUrl, getSlugs } from 'fumadocs-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[] = ['/api/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;