-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathreact-server.config.mjs
More file actions
59 lines (57 loc) · 1.47 KB
/
Copy pathreact-server.config.mjs
File metadata and controls
59 lines (57 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import rehypeHighlight from "rehype-highlight";
import rehypeKatex from "rehype-katex";
import rehypeMdxCodeProps from "rehype-mdx-code-props";
import remarkGfm from "remark-gfm";
import remarkMath from "remark-math";
export default {
root: "src/pages",
public: "public",
adapter: "cloudflare",
mdx: {
remarkPlugins: [remarkGfm, remarkMath],
rehypePlugins: [
[rehypeHighlight, { detect: true }],
rehypeMdxCodeProps,
rehypeKatex,
],
components: "./src/mdx-components.jsx",
},
prerender: false,
export(paths) {
const pagePaths = paths
.map(({ path }) => path.replace(/^\/en/, ""))
.filter((p) => p !== "/" && p !== "/404" && p.length > 1);
return [
...paths.map(({ path }) => ({
path: path.replace(/^\/en/, ""),
filename: (path === "/"
? "index.html"
: `${path.slice(1)}.html`
).replace(/^en\//, "/"),
rsc: false,
})),
// Markdown versions of all docs pages for AI usage
...pagePaths.map((path) => ({
path: `${path}.md`,
filename: `${path.slice(1)}.md`,
method: "GET",
})),
{
path: "/sitemap.xml",
filename: "sitemap.xml",
method: "GET",
headers: {
accept: "application/xml",
},
},
{
path: "/schema.json",
filename: "schema.json",
method: "GET",
headers: {
accept: "application/json",
},
},
];
},
};