Repository navigation
Expand file tree
/
Copy pathnext.config.ts
More file actions
92 lines (88 loc) · 1.75 KB
/
Copy pathnext.config.ts
File metadata and controls
92 lines (88 loc) · 1.75 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import type { NextConfig } from "next";
import createNextIntlPlugin from "next-intl/plugin";
import createMDX from "@next/mdx";
const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");
const withMDX = createMDX({
options: {
remarkPlugins: [
"remark-math",
"remark-gfm",
"remark-frontmatter",
["remark-mdx-frontmatter", { name: "frontmatter" }],
],
rehypePlugins: ["rehype-katex"],
},
});
const nextConfig: NextConfig = {
pageExtensions: ["js", "jsx", "ts", "tsx", "md", "mdx"],
images: {
unoptimized: true,
remotePatterns: [
{
protocol: "https",
hostname: "*",
},
],
},
async headers() {
return [
{
source: "/:path*",
headers: [
{
key: "Content-Security-Policy",
value: "frame-src https://giscus.app https://player.bilibili.com;",
},
],
},
];
},
async redirects() {
return [
// Locale migration redirects
{
source: "/zh-CN",
destination: "/zh",
permanent: true,
},
{
source: "/zh-CN/:path*",
destination: "/zh/:path*",
permanent: true,
},
{
source: "/en-US",
destination: "/en",
permanent: true,
},
{
source: "/en-US/:path*",
destination: "/en/:path*",
permanent: true,
},
// /p/:slug → /essay/:slug migration
{
source: "/p/:slug",
destination: "/essay/:slug",
permanent: true,
},
// Social links
{
source: "/s/twitter",
destination: "https://twitter.com/renedotwang",
permanent: true,
},
{
source: "/s/pixiv",
destination: "https://www.pixiv.net/en/users/35572742",
permanent: true,
},
{
source: "/rss",
destination: "https://rene.wang/rss/feed.xml",
permanent: false,
},
];
},
};
export default withMDX(withNextIntl(nextConfig));