-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnext.config.v2.js
121 lines (120 loc) · 3.52 KB
/
next.config.v2.js
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/** @type {import("next").NextConfig} */
module.exports = {
compiler: {
styledComponents: true,
},
redirects: [
// Redirect old Drash v2.x URLs (/drash/v2.x) to new URLs (/drash-v2.x)
{
source: "/drash/v2.x/:path*",
destination: "/drash-v2.x/:path*",
permanent: false,
},
// Redirect pages without content to the nearest page with content
{
source: "/drash/v2.x",
destination: "/drash-v2.x/getting-started/introduction",
permanent: false,
},
{
source: "/drash/v2.x/getting-started",
destination: "/drash-v2.x/getting-started/introduction",
permanent: false,
},
{
source: "/drash/v2.x/tutorials",
destination:
"/drash-v2.x/tutorials/introduction/add-drash-as-a-dependency",
permanent: false,
},
{
source: "/drash/v2.x/tutorials/resources",
destination: "/drash-v2.x/tutorials/resources/creating-a-resource",
permanent: false,
},
{
source: "/drash/v2.x/tutorials/requests",
destination: "/drash-v2.x/tutorials/requests/handling-json-bodies",
permanent: false,
},
{
source: "/drash/v2.x/tutorials/responses",
destination: "/drash-v2.x/tutorials/responses/setting-the-body",
permanent: false,
},
{
source: "/drash/v2.x/tutorials/services",
destination: "/drash-v2.x/tutorials/services/introduction",
permanent: false,
},
// Remove the below /drash/v1.x object when its migrated
{
source: "/drash/v1.x",
destination: "/drash/v1.x/index.html",
permanent: false,
},
{
source: "/wocket/v0.x",
destination: "/wocket/v0.x/index.html",
permanent: false,
},
// Remove the below /dmm object when the its migrated
{
source: "/dmm/v1.x",
destination: "/dmm/v1.x/index.html",
permanent: false,
},
// Remove the below /rhum object when the its migrated
{
source: "/rhum/v1.x",
destination: "/rhum/v1.x/index.html",
permanent: false,
},
{
source: "/line/v0.x",
destination: "/line/v0.x/index.html",
permanent: false,
},
{
source: "/sinco/v1.x",
destination: "/sinco/v1.x/index.html",
permanent: false,
},
// Redirect pages that have their URLs changed and document when the redirection should be
// removed. Redirections should be removed at least 2 months out.
permanentRedirect(
// Remove on 07-01-2022
"/drash/v2.x/tutorials/services/introduction",
"/drash/v2.x/tutorials/services/basics",
),
permanentRedirect(
// Remove on 07-01-2022
"/drash/v2.x/tutorials/services/creating-services",
"/drash/v2.x/tutorials/services/creating-services/introduction",
),
permanentRedirect(
// Remove on 07-01-2022
"/drash/v2.x/tutorials/services/adding-server-level-services",
"/drash/v2.x/tutorials/services/creating-services/server-level/introduction",
),
permanentRedirect(
// Remove on 07-01-2022
"/drash/v2.x/tutorials/services/adding-resource-level-services",
"/drash/v2.x/tutorials/services/creating-services/resource-level/introduction",
),
],
};
/**
* Create a permanent redirect.
*
* @param {string} source - Where are we redirecting from?
* @param {string} destination - Where are we redirecting to?
* @returns {object} - Object with source, destination, and permanent fields.
*/
function permanentRedirect(source, destination) {
return {
source,
destination,
permanent: true,
};
}