-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
84 lines (75 loc) · 1.92 KB
/
next.config.js
File metadata and controls
84 lines (75 loc) · 1.92 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
import withPlugins from "next-compose-plugins";
import nextMDX from "@next/mdx";
import html from "remark-html";
import prism from "remark-prism";
import slug from "rehype-slug";
import headings from "rehype-autolink-headings";
import externalLinks from "rehype-external-links";
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [[prism, { showSpotlight: true }], html],
rehypePlugins: [
slug,
[
headings,
{
behavior: "append",
content: {
type: "element",
tagName: "span",
properties: { className: ["headinglink"] },
},
},
],
[externalLinks, { target: false, rel: ["noopener"] }],
],
},
});
const nextConfig = {
trailingSlash: false,
images: {
deviceSizes: [320, 768, 1024, 1200, 1900],
},
swcMinify: true,
async redirects() {
return [
{
source: "/blog/page/1",
destination: "/blog",
permanent: false,
},
// move blog posts from root to year subfolders
...getPosts(2020),
...getPosts(2021),
];
},
};
export default withPlugins([
// https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions
[withMDX, { pageExtensions: ["page.ts", "page.tsx", "page.mdx"] }],
nextConfig,
]);
const moved_posts = {
2020: [
"definition-lists-with-grid-layout",
"tech-debt-tech-loan",
"empty-objects-initialization-with-typescript",
],
2021: [
"distinguishing-between-pages-and-components-in-next-js",
"complementary-learning",
"validating-our-understanding",
"developing-uis-connected-to-web-apis",
"css-in-js-styles-output",
"react-components-anatomy",
"isolated-components-driven-development",
],
};
function getPosts(year) {
return moved_posts[year].map((post) => ({
source: `/blog/${post}`,
destination: `/blog/${year}/${post}`,
permanent: true,
}));
}