forked from MikaStiebitz/Git-Mastery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
94 lines (89 loc) · 3.08 KB
/
next.config.js
File metadata and controls
94 lines (89 loc) · 3.08 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
93
94
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
* for Docker builds.
*/
await import("./src/env.js");
/** @type {import("next").NextConfig} */
const config = {
// Ensure trailing slash consistency
trailingSlash: false,
// Enable React 19 features
experimental: {
// Better development experience with server components HMR
serverComponentsHmrCache: true,
},
// Add headers for better SEO
async headers() {
return [
// Remove global X-Robots-Tag to allow page-specific robots meta tags to work
// Individual pages control their own indexing via metadata
];
},
// Ensure proper redirects
async redirects() {
return [
// Redirect /level?stage=intro&level=X to /intro?level=X (and similar for other stages)
{
source: "/level",
has: [
{ type: "query", key: "stage", value: "intro" },
{ type: "query", key: "level", value: "(?<level>\\d+)" },
],
destination: "/intro?level=:level",
permanent: true,
},
{
source: "/level",
has: [
{ type: "query", key: "stage", value: "files" },
{ type: "query", key: "level", value: "(?<level>\\d+)" },
],
destination: "/files?level=:level",
permanent: true,
},
{
source: "/level",
has: [
{ type: "query", key: "stage", value: "branches" },
{ type: "query", key: "level", value: "(?<level>\\d+)" },
],
destination: "/branches?level=:level",
permanent: true,
},
{
source: "/level",
has: [
{ type: "query", key: "stage", value: "merge" },
{ type: "query", key: "level", value: "(?<level>\\d+)" },
],
destination: "/merge?level=:level",
permanent: true,
},
{
source: "/level",
has: [
{ type: "query", key: "stage", value: "rebase" },
{ type: "query", key: "level", value: "(?<level>\\d+)" },
],
destination: "/rebase?level=:level",
permanent: true,
},
{
source: "/level",
has: [
{ type: "query", key: "stage", value: "remote" },
{ type: "query", key: "level", value: "(?<level>\\d+)" },
],
destination: "/remote?level=:level",
permanent: true,
},
// Redirect /level without parameters to homepage
{
source: "/level",
destination: "/",
permanent: true,
},
];
},
};
export default config;