From c476501d0d4900f69d56f2979d5ba5fa4f4fc038 Mon Sep 17 00:00:00 2001 From: Damjan Dimitrov Date: Fri, 10 May 2024 10:10:22 +0200 Subject: [PATCH] Add broken wiki link redirects --- .vuepress/clientAppEnhance.js | 26 ++++++++++++++++++++++++++ .vuepress/config.ts | 1 + 2 files changed, 27 insertions(+) create mode 100644 .vuepress/clientAppEnhance.js diff --git a/.vuepress/clientAppEnhance.js b/.vuepress/clientAppEnhance.js new file mode 100644 index 00000000..36b9d9e4 --- /dev/null +++ b/.vuepress/clientAppEnhance.js @@ -0,0 +1,26 @@ +import { defineClientConfig } from '@vuepress/client' + +export default defineClientConfig({ + enhance({ app, router, siteData }) { + router.beforeEach((to, from, next) => { + const redirectMap = { + '/build/2-web3-services.html#storage-bucket': '/web3-services/2-web3-storage.html#storage-bucket', + '/build/2-web3-services.html#web3-hosting': '/web3-services/3-web3-hosting.html', + '/build/3-apillon-api.html#web3-hosting-api': '/build/3-hosting-api.html', + '/build/3-apillon-api.html#web3-storage-api': '/build/2-storage-api.html', + '/build/3-apillon-api.html': '/build/1-apillon-api.html', + '/build/3-apillon-api.html#api-to-web3': '/build/1-apillon-api.html', + '/build/#concepts': '/web3-services/1-good-to-know.html#concepts', + '/build/2-web3-services.html#web3-storage': '/web3-services/2-web3-storage.html', + '/build/2-web3-services.html#nfts': '/web3-services/4-nfts.html', + '/build/#ipfs': '/web3-services/1-good-to-know.html#ipfs' + }; + const redirectPath = redirectMap[to.fullPath]; + if (redirectPath) { + next({ path: redirectPath }); + } else { + next(); + } + }); + }, +}); diff --git a/.vuepress/config.ts b/.vuepress/config.ts index 7c41b894..977fc0d9 100644 --- a/.vuepress/config.ts +++ b/.vuepress/config.ts @@ -58,6 +58,7 @@ export default defineUserConfig({ componentsDir: path.resolve(__dirname, "./components"), }) as any, ], + clientConfigFile: path.resolve(__dirname, './clientAppEnhance.js'), }); //Generate Nav