mirror of
https://github.com/Xevion/xevion.dev.git
synced 2025-12-06 05:17:10 -06:00
Setup redirection for certain posts to new undefined behaviors blog
This commit is contained in:
@@ -5,34 +5,61 @@
|
||||
*/
|
||||
!process.env.SKIP_ENV_VALIDATION && (await import("./src/env/server.mjs"));
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} text The string to search around with the pattern in.
|
||||
* @param {string} pattern The strict, text only pattern to search for.
|
||||
* @param {number} nth The index of the pattern to find.
|
||||
* @returns
|
||||
*/
|
||||
function nthIndex(text, pattern, nth) {
|
||||
const L = text.length;
|
||||
let i = -1;
|
||||
while (nth-- && i++ < L) {
|
||||
i = text.indexOf(pattern, i);
|
||||
if (i < 0) break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
const v2_redirects = [
|
||||
'/2020/12/04/jekyll-github-pages-and-azabani',
|
||||
'/2021/02/25/project-facelift-new-and-old',
|
||||
'/2022/03/29/runnerspace-built-in-under-30-hours',
|
||||
'/2022/07/16/restricted-memory-and-data-framing-tricks',
|
||||
'/drafts/presenting-to-humans',
|
||||
'/photography'
|
||||
].map(url => {
|
||||
"/2020/12/04/jekyll-github-pages-and-azabani",
|
||||
"/2021/02/25/project-facelift-new-and-old",
|
||||
"/2022/03/29/runnerspace-built-in-under-30-hours",
|
||||
"/2022/07/16/restricted-memory-and-data-framing-tricks",
|
||||
"/drafts/presenting-to-humans",
|
||||
"/photography",
|
||||
].map((url) => {
|
||||
if (url.startsWith("/2"))
|
||||
return {
|
||||
source: url, destination: `https://v2.xevion.dev${url}`, permanent: false
|
||||
}
|
||||
})
|
||||
source: url,
|
||||
destination: `https://undefined.behavio.rs/posts${url.slice(
|
||||
nthIndex(url, "/", 4)
|
||||
)}`,
|
||||
permanent: false,
|
||||
};
|
||||
|
||||
return {
|
||||
source: url,
|
||||
destination: `https://v2.xevion.dev${url}`,
|
||||
permanent: false,
|
||||
};
|
||||
});
|
||||
|
||||
/** @type {import("next").NextConfig} */
|
||||
const config = {
|
||||
reactStrictMode: true,
|
||||
swcMinify: true,
|
||||
i18n: {
|
||||
locales: ["en"],
|
||||
defaultLocale: "en",
|
||||
},
|
||||
async redirects() {
|
||||
// Source cannot end with / slash
|
||||
return [
|
||||
{source: '/resume', destination: '/resume.pdf', permanent: false},
|
||||
...v2_redirects
|
||||
]
|
||||
}
|
||||
reactStrictMode: true,
|
||||
swcMinify: true,
|
||||
i18n: {
|
||||
locales: ["en"],
|
||||
defaultLocale: "en",
|
||||
},
|
||||
async redirects() {
|
||||
// Source cannot end with / slash
|
||||
return [
|
||||
{ source: "/resume", destination: "/resume.pdf", permanent: false },
|
||||
...v2_redirects,
|
||||
];
|
||||
},
|
||||
};
|
||||
export default config;
|
||||
|
||||
Reference in New Issue
Block a user