Skip to content

Commit 912def6

Browse files
committed
Fix LICENSE and relative links in docs website
- Add License to DOCS mapping and sidebar navigation - Add LINK_MAP to intercept relative links (LICENSE, CONTRIBUTING.md, etc.) - Clicking LICENSE link now loads license content instead of 404 - All relative doc links now properly navigate within the site
1 parent bbd6e49 commit 912def6

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

docs/index.html

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@
368368
<a href="#contributing" class="nav-link" data-doc="contributing"><span class="icon">🤝</span> Contributing</a>
369369
<a href="#security" class="nav-link" data-doc="security"><span class="icon">🔒</span> Security</a>
370370
<a href="#coc" class="nav-link" data-doc="coc"><span class="icon">📜</span> Code of Conduct</a>
371+
<a href="#license" class="nav-link" data-doc="license"><span class="icon">⚖️</span> License</a>
371372
</div>
372373

373374
<div class="nav-section">
@@ -402,7 +403,8 @@
402403
usage: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/docs/USAGE.md',
403404
contributing: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/CONTRIBUTING.md',
404405
security: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/SECURITY.md',
405-
coc: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/CODE_OF_CONDUCT.md'
406+
coc: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/CODE_OF_CONDUCT.md',
407+
license: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/LICENSE'
406408
};
407409

408410
const contentEl = document.getElementById('content');
@@ -449,6 +451,16 @@
449451
gfm: true
450452
});
451453

454+
// Map relative links to doc names
455+
const LINK_MAP = {
456+
'LICENSE': 'license',
457+
'CONTRIBUTING.md': 'contributing',
458+
'SECURITY.md': 'security',
459+
'CODE_OF_CONDUCT.md': 'coc',
460+
'docs/API.md': 'api',
461+
'docs/USAGE.md': 'usage'
462+
};
463+
452464
async function loadDoc(docName) {
453465
const url = DOCS[docName];
454466
if (!url) return;
@@ -463,6 +475,21 @@
463475
Prism.highlightAll();
464476
window.scrollTo({ top: 0, behavior: 'smooth' });
465477

478+
// Intercept relative links in content
479+
contentEl.querySelectorAll('a').forEach(link => {
480+
const href = link.getAttribute('href');
481+
if (href && !href.startsWith('http') && !href.startsWith('#')) {
482+
const docKey = LINK_MAP[href];
483+
if (docKey) {
484+
link.addEventListener('click', (e) => {
485+
e.preventDefault();
486+
loadDoc(docKey);
487+
history.pushState(null, '', `#${docKey}`);
488+
});
489+
}
490+
}
491+
});
492+
466493
// Close mobile menu
467494
sidebar.classList.remove('active');
468495
overlay.classList.remove('active');

0 commit comments

Comments
 (0)