Skip to content

Commit

Permalink
do base, get baserepo function
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarusA committed Sep 18, 2024
1 parent ad24a25 commit dcf271d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default defineConfig({
outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly...
head: [
['link', { rel: 'icon', href: '/DocumenterVitepress.jl/dev/favicon.ico' }],
['script', {src: '/DocumenterVitepress.jl/versions.js'}],
['script', {src: `${baseTemp.base}versions.js`}],
['script', {src: `${baseTemp.base}siteinfo.js`}]
],
vite: {
Expand Down
12 changes: 11 additions & 1 deletion docs/src/.vitepress/theme/VersionPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,21 @@ const waitForGlobalDocumenterVars = () => {
});
};

const getBaseRepository = () => {
// Extract the base repository from the current path
const pathParts = window.location.pathname.split('/');
return pathParts[1] || ''; // The first part after the domain should be the repo name
}

onMounted(async () => {
try {
const globalvars = await waitForGlobalDocumenterVars();
const baseRepo = getBaseRepository();
versions.value = globalvars.versions.map((v) => {
return {text: v, link: `${window.location.origin}/${v}/`}
return {
text: v,
link: `${window.location.origin}/${baseRepo}/${v}/`
}
});
currentVersion.value = globalvars.currentVersion;
} catch (error) {
Expand Down

0 comments on commit dcf271d

Please sign in to comment.