Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Release to 2024.10.2 #18

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/kedro_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from sphinx.application import Sphinx

__version__ = "2024.10.0"
__version__ = "2024.10.2"

THEME_PATH = (Path(__file__).parent / "theme" / "kedro-sphinx-theme").resolve()

Expand Down
33 changes: 20 additions & 13 deletions src/kedro_sphinx_theme/theme/kedro-sphinx-theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>

<div class="wy-main-nav">
<a id='kedro' class="wy-main-nav-link" href="/">Kedro</a>
<a id='kedro' class="wy-main-nav-link" href="https://docs.kedro.org/en/stable">Kedro</a>
<a id='kedro-viz' class="wy-main-nav-link" href="https://docs.kedro.org/projects/kedro-viz/en/stable/">Kedro-Viz</a>
<a id='kedro-datasets' class="wy-main-nav-link" href="https://docs.kedro.org/projects/kedro-datasets">Kedro-Datasets</a>
</div>
Expand All @@ -32,6 +32,20 @@
//inline styling for read-the-docs flyout
document.documentElement.style.setProperty('--readthedocs-flyout-font-size', '0.9em');

function highlightActiveLink() {
var currentUrl = window.location.href;
const links = document.querySelectorAll(".wy-main-nav .wy-main-nav-link");

// Iterate over each link and check if its href is part of the current URL
links.forEach(link => {
if (currentUrl.includes(link.href)) {
link.classList.add("active");
} else {
link.classList.remove("active"); // Remove the active class if it's not active
}
});
}

document.addEventListener("DOMContentLoaded", function() {

function showReadTheDocsSearch() {
Expand Down Expand Up @@ -66,19 +80,12 @@
openBtn.classList.add('wy-nav-top-open');
document.querySelector('.wy-nav-top').prepend(openBtn);

// Select all navigation links within the .wy-main-nav container
var navLinks = document.querySelectorAll('.wy-main-nav .wy-main-nav-link');
var currentPath = window.location.pathname;
highlightActiveLink();

// Iterate over each link to check if the current path includes the link's unique ID
navLinks.forEach(function(link) {
var kedroSpecificPath = 'https://docs.kedro.org/en';
var isKedroLink = link.id === 'kedro';

if ((isKedroLink && currentPath.includes(kedroSpecificPath)) || (!isKedroLink && currentPath.includes(link.id))) {
link.classList.add('active');
}
// Optionally, listen for URL changes (e.g., when using history.pushState)
window.addEventListener('popstate', function(event) {
highlightActiveLink();
});
});
});
</script>
{% endblock %}
Loading