fix: Remove basepath from docs

This commit is contained in:
Sidharth Vinod
2022-12-19 13:29:09 +05:30
parent 7670ada9ac
commit 8e7dd1d148
3 changed files with 6 additions and 4 deletions

View File

@@ -14,9 +14,9 @@ export default defineConfig({
lang: 'en-US', lang: 'en-US',
title: 'Mermaid', title: 'Mermaid',
description: 'Create diagrams and visualizations using text and code.', description: 'Create diagrams and visualizations using text and code.',
base: '/mermaid/', base: '/',
markdown: allMarkdownTransformers, markdown: allMarkdownTransformers,
head: [['link', { rel: 'icon', type: 'image/x-icon', href: '/mermaid/favicon.ico' }]], head: [['link', { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]],
themeConfig: { themeConfig: {
nav: nav(), nav: nav(),
editLink: { editLink: {

View File

@@ -18,7 +18,7 @@ export default {
if (newPath) { if (newPath) {
console.log(`Redirecting to ${newPath} from ${window.location}`); console.log(`Redirecting to ${newPath} from ${window.location}`);
// router.go isn't loading the ID properly. // router.go isn't loading the ID properly.
window.location.href = `/mermaid/${newPath}`; window.location.href = `/${newPath}`;
} }
} catch (e) {} } catch (e) {}
}; };

View File

@@ -10,7 +10,9 @@ export interface Redirect {
const getBaseFile = (link: string): Redirect => { const getBaseFile = (link: string): Redirect => {
const url = new URL(link); const url = new URL(link);
if ( if (
(url.hostname !== 'mermaid-js.github.io' && url.hostname !== 'localhost') || (url.hostname !== 'mermaid-js.github.io' &&
url.hostname !== 'mermaid.js.org' &&
url.hostname !== 'localhost') ||
url.pathname !== '/mermaid/' url.pathname !== '/mermaid/'
) { ) {
throw new Error('Not mermaidjs url'); throw new Error('Not mermaidjs url');