Skip to content

Commit 2963bfd

Browse files
committed
Implement a redirection system with a mapping
1 parent f4b06bc commit 2963bfd

15 files changed

+287
-59
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,6 @@ storybook-static/
138138
# Sentry Auth Token
139139
.sentryclirc
140140
.astro
141+
142+
# Generated static redirects
143+
generated/

astro.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import remarkToc from "remark-toc";
88
import rehypeSlug from "rehype-slug";
99
import rehypeAutolinkHeadings from "rehype-autolink-headings";
1010
import metaTags from "astro-meta-tags";
11+
import publicDir from 'astro-public';
1112

1213
// https://astro.build/config
1314
export default defineConfig({
@@ -42,6 +43,8 @@ export default defineConfig({
4243
nesting: true,
4344
}),
4445
metaTags(),
46+
publicDir("generated/"),
4547
],
4648
output: "static",
49+
middleware: "src/middleware.js",
4750
});

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"type": "module",
44
"version": "0.0.1",
55
"scripts": {
6-
"dev": "astro dev",
6+
"prepare": "node scripts/generate-redirect-html.cjs && node scripts/create-static-redirects.cjs",
7+
"dev": "concurrently --kill-others --success first --raw --signal SIGKILL \"nodemon --exitcrash -w src/data/redirects.json -e json -x \\\"pnpm prepare\\\"\" \"pnpm astro dev\"",
8+
"build": "astro check && astro prepare && astro build",
79
"start": "astro dev",
8-
"build": "astro check && astro build",
910
"preview": "astro preview",
1011
"astro": "astro",
1112
"format": "prettier --write --plugin=prettier-plugin-astro ."
@@ -23,6 +24,7 @@
2324
"@types/react-dom": "^18.3.5",
2425
"astro": "^5.1.6",
2526
"astro-meta-tags": "^0.3.1",
27+
"astro-public": "^0.1.1",
2628
"clsx": "^2.1.1",
2729
"date-fns": "^4.1.0",
2830
"date-fns-tz": "^3.2.0",
@@ -37,8 +39,10 @@
3739
"typescript": "^5.7.3"
3840
},
3941
"devDependencies": {
42+
"concurrently": "^9.1.2",
4043
"prettier": "^3.4.2",
41-
"prettier-plugin-astro": "^0.14.1"
44+
"prettier-plugin-astro": "^0.14.1",
45+
"nodemon": "^3.1.9"
4246
},
4347
"prettier": {
4448
"proseWrap": "always"

0 commit comments

Comments
 (0)