diff --git a/website/client/src/directives/markdown.js b/website/client/src/directives/markdown.js index 99237ee1c8..f4da7164f2 100644 --- a/website/client/src/directives/markdown.js +++ b/website/client/src/directives/markdown.js @@ -8,6 +8,8 @@ export default function markdown (el, { value, oldValue }) { } else { el.innerHTML = ''; } + // This is a hack, but it's one idea for how we might do things + el.innerHTML = el.innerHTML.replace('href="h', 'href="/external?link=h'); el.classList.add('markdown'); } diff --git a/website/client/src/router/index.js b/website/client/src/router/index.js index 09727c789e..4ea5092447 100644 --- a/website/client/src/router/index.js +++ b/website/client/src/router/index.js @@ -377,6 +377,8 @@ const router = new VueRouter({ ], }, + { name: 'externalLink', path: '/external' }, + // Only used to handle some redirects // See router.beforeEach { path: '/redirect/:redirect', name: 'redirect' }, @@ -393,6 +395,11 @@ router.beforeEach(async (to, from, next) => { if (to.name === 'redirect') return handleRedirect(to, from, next); + if (to.name === 'externalLink') { + setTimeout(() => router.app.$emit('bv::show::modal', 'external-link-modal'), 500); + return null; + } + if (!isUserLoggedIn && routeRequiresLogin) { // Redirect to the login page unless the user is trying to reach the // root of the website, in which case show the home page.