Skip to content

Commit

Permalink
fix: Manually implement external redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 committed Dec 4, 2023
1 parent 2cce500 commit a66327c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions main/.vuepress/enhanceApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ function patchRoutesToPreserveFragments(router) {

export default ({ router }) => {
patchRoutesToPreserveFragments(router);
// The router assumes everything is site-local, so manually implement external redirection
// to avoid Not Found URLs like 'https://docs.agoric.com/https:/github.com/...'.
// cf. https://github.com/vuejs/vue-router/issues/1280 and
// https://stackoverflow.com/questions/62254666/use-vue-router-for-redirecting-to-absolute-path
const makeExternalRedirect = target => {
const externalRedirect = () => {
location.assign(target);
};
return externalRedirect;
};
const redirects = [
{ path: '/chainlink-integration.html', redirect: '/guides/chainlink-integration/' },
{ path: '/chainlink-integration/', redirect: '/guides/chainlink-integration/' },
Expand All @@ -62,9 +72,9 @@ export default ({ router }) => {
{ path: '/getting-started/intro-zoe.html', redirect: '/guides/zoe/offer-enforcement.html' },
{ path: '/getting-started/start-a-project.html', redirect: '/guides/getting-started/start-a-project.html' },
{ path: '/guides/agoric-cli/commands.html', redirect: '/guides/agoric-cli/' },
{ path: '/guides/js-programming/ses/lockdown.html', redirect: 'https://github.com/endojs/endo/blob/HEAD/packages/ses/docs/lockdown.html' },
{ path: '/guides/js-programming/ses/ses-guide.html', redirect: 'https://github.com/endojs/endo/blob/HEAD/packages/ses/docs/guide.html' },
{ path: '/guides/js-programming/ses/ses-reference.html', redirect: 'https://github.com/endojs/endo/blob/HEAD/packages/ses/docs/reference.html' },
{ path: '/guides/js-programming/ses/lockdown.html', redirect: makeExternalRedirect('https://github.com/endojs/endo/blob/master/packages/ses/docs/lockdown.md') },
{ path: '/guides/js-programming/ses/ses-guide.html', redirect: makeExternalRedirect('https://github.com/endojs/endo/blob/master/packages/ses/docs/guide.md') },
{ path: '/guides/js-programming/ses/ses-reference.html', redirect: makeExternalRedirect('https://github.com/endojs/endo/blob/master/packages/ses/docs/reference.md') },
{ path: '/guides/wallet/api.html', redirect: '/reference/wallet-api.html' },
{ path: '/platform/', redirect: '/guides/platform/' },
{ path: '/repl/', redirect: '/reference/repl/' },
Expand Down

0 comments on commit a66327c

Please sign in to comment.