mirror of
https://github.com/Xevion/xevion.dev.git
synced 2025-12-06 09:17:05 -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"));
|
!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 = [
|
const v2_redirects = [
|
||||||
'/2020/12/04/jekyll-github-pages-and-azabani',
|
"/2020/12/04/jekyll-github-pages-and-azabani",
|
||||||
'/2021/02/25/project-facelift-new-and-old',
|
"/2021/02/25/project-facelift-new-and-old",
|
||||||
'/2022/03/29/runnerspace-built-in-under-30-hours',
|
"/2022/03/29/runnerspace-built-in-under-30-hours",
|
||||||
'/2022/07/16/restricted-memory-and-data-framing-tricks',
|
"/2022/07/16/restricted-memory-and-data-framing-tricks",
|
||||||
'/drafts/presenting-to-humans',
|
"/drafts/presenting-to-humans",
|
||||||
'/photography'
|
"/photography",
|
||||||
].map(url => {
|
].map((url) => {
|
||||||
|
if (url.startsWith("/2"))
|
||||||
return {
|
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} */
|
/** @type {import("next").NextConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
swcMinify: true,
|
swcMinify: true,
|
||||||
i18n: {
|
i18n: {
|
||||||
locales: ["en"],
|
locales: ["en"],
|
||||||
defaultLocale: "en",
|
defaultLocale: "en",
|
||||||
},
|
},
|
||||||
async redirects() {
|
async redirects() {
|
||||||
// Source cannot end with / slash
|
// Source cannot end with / slash
|
||||||
return [
|
return [
|
||||||
{source: '/resume', destination: '/resume.pdf', permanent: false},
|
{ source: "/resume", destination: "/resume.pdf", permanent: false },
|
||||||
...v2_redirects
|
...v2_redirects,
|
||||||
]
|
];
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
export default config;
|
export default config;
|
||||||
|
|||||||
Reference in New Issue
Block a user