Skip to content

Commit

Permalink
Test docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pantonante committed Feb 19, 2024
1 parent 3fab877 commit a7eb1a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/docs" # App source code path
api_location: "" # Api source code path - optional
output_location: "/dist/v0.3" # Built app content directory - optional
output_location: "/dist/" # Built app content directory - optional
###### End of Repository/Build Configurations ######
skip_api_build: true

Expand Down
5 changes: 3 additions & 2 deletions docs/src/components/ThemeSelect.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import Select from '@astrojs/starlight/components/Select.astro';
import { defaultVersion, versions } from '../content/config.ts';
const url = new URL(Astro.url);
const currentVersion = /^\/v\d+/.test(url.pathname)
const currentVersion = /^\/v\d\.\d+/.test(url.pathname)
? url.pathname.split('/')[1]
: defaultVersion;
console.log(currentVersion);
const options = versions.map(([version, label]) => ({
label,
selected: currentVersion === version,
Expand All @@ -19,7 +20,7 @@ const options = versions.map(([version, label]) => ({
const select = document.querySelector('select');
select?.addEventListener('change', () => {
const url = new URL(window.location.href);
const pathname = select.value + url.pathname.replace(/^\/v\d/, '');
const pathname = select.value + url.pathname.replace(/^\/v\d\.\d+/, '');
url.pathname = pathname.replace(/\/$/, '');
window.location.href = url.href;
});
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const collections = {
export const base = '/';

export const versions = [
['v0.3', 'v0.3 (canary)'],
['v0.2', 'v0.2 (latest)'],
['v0.3', 'v0.3.x (canary)'],
['v0.2', 'v0.2.x (latest)'],
];

export const defaultVersion = 'v0.3';

0 comments on commit a7eb1a3

Please sign in to comment.