2024-05-30 04:00:41 +02:00
|
|
|
<script setup>
|
|
|
|
import DefaultTheme from 'vitepress/theme'
|
|
|
|
import { useRouter } from 'vitepress'
|
|
|
|
import { onBeforeMount } from 'vue';
|
2024-06-03 00:55:03 +02:00
|
|
|
import aliases from "../../../../docs/_aliases.json";
|
2024-05-30 04:00:41 +02:00
|
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
onBeforeMount(async () => {
|
2024-06-03 00:55:03 +02:00
|
|
|
// Convert from docsify-style to vitepress-style URLs
|
|
|
|
let newUrl = window.location.href.replace(/\/#\//, '/').replace(/\?id=/, '#');
|
|
|
|
|
|
|
|
// Convert any aliases
|
|
|
|
let testUrl = new URL(newUrl);
|
|
|
|
while (testUrl.pathname in aliases) {
|
|
|
|
testUrl.pathname = aliases[testUrl.pathname];
|
|
|
|
}
|
|
|
|
newUrl = testUrl.toString();
|
|
|
|
|
|
|
|
// Redirect if required
|
|
|
|
if (newUrl != window.location.href) {
|
2024-05-30 04:00:41 +02:00
|
|
|
window.history.replaceState({}, '', newUrl);
|
|
|
|
await router.go(newUrl);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<DefaultTheme.Layout/>
|
|
|
|
</template>
|