smol fix to nav bar

This commit is contained in:
Ramon Perez 2025-09-05 20:13:04 +10:00
parent 17da6d4ada
commit 9e8dc9f84a

View File

@ -59,7 +59,8 @@ export default defineConfig({
} }
// Add navigation to regular docs pages // Add navigation to regular docs pages
setTimeout(() => { // Add navigation to docs pages with retry logic
function addNavigation(retries = 0) {
const currentPath = window.location.pathname; const currentPath = window.location.pathname;
// Skip if page has its own navigation // Skip if page has its own navigation
@ -76,6 +77,7 @@ export default defineConfig({
const searchContainer = header.querySelector('[class*="search"]')?.parentElement; const searchContainer = header.querySelector('[class*="search"]')?.parentElement;
const targetContainer = searchContainer || header.querySelector('.sl-flex') || header; const targetContainer = searchContainer || header.querySelector('.sl-flex') || header;
if (targetContainer) {
// Create navigation container // Create navigation container
const nav = document.createElement('nav'); const nav = document.createElement('nav');
nav.className = 'custom-nav-links'; nav.className = 'custom-nav-links';
@ -102,8 +104,22 @@ export default defineConfig({
} else { } else {
targetContainer.appendChild(nav); targetContainer.appendChild(nav);
} }
} else if (retries < 3) {
// Retry if container not found yet
setTimeout(() => addNavigation(retries + 1), 200);
}
} else if (retries < 3) {
// Retry if header/title not found yet
setTimeout(() => addNavigation(retries + 1), 200);
}
}
// Start navigation injection
if (document.readyState === 'loading') {
setTimeout(() => addNavigation(), 100);
} else {
addNavigation();
} }
}, 100);
}); });
`, `,
}, },