// Horizontal Navigation Bar for Llama Stack Documentation document.addEventListener('DOMContentLoaded', function() { // Create the horizontal navigation HTML const navHTML = ` `; // Insert the navigation at the beginning of the body document.body.insertAdjacentHTML('afterbegin', navHTML); // Update navigation links based on current page updateActiveNav(); }); function updateActiveNav() { const currentPath = window.location.pathname; const navLinks = document.querySelectorAll('.horizontal-nav .nav-links a'); navLinks.forEach(link => { // Remove any existing active classes link.classList.remove('active'); // Add active class based on current path if (currentPath === '/' && link.getAttribute('href') === '/') { link.classList.add('active'); } else if (currentPath.includes('/references/api_reference/') && link.getAttribute('href').includes('api_reference')) { link.classList.add('active'); } }); }