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

Feature: Display main navigation to ancestors of excluded pages #1584

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

pdmosses
Copy link
Contributor

See discussion #1566 for motivation.

Currently (v0.10.0) the cached site-nav used in the sidebar contains links only to pages that are not excluded from the main navigation. When an excluded page is selected, the navigation path to any ancestors disappears.

This draft PR makes the cached site-nav used in the sidebar contain links to all pages, but adds the nav-exclude class to the HTML of links to excluded pages. The CSS for the navigation then suppresses the display of those links, and the JS scrolls the navigation to the closest non-excluded ancestor link.

Preliminary testing with the Just-the-Docs-Tests repo was successful with JS enabled. The generated page-specific CSS will need adjustment to give the same navigation when JS is disabled. Rigorous testing will be needed to ensure that this should be a non-breaking change for non-customised sites.

The parameter include.all of several included files is now redundant, and should be removed before the code is reviewed.

(The included updates to Gemfile and Gemfile.lock should be removed when a new version of the theme is released and this PR is updated to use it.)

To experiment with using this (draft) PR, use theme: just-the-docs in _config.yml and the following in your Gemfile:

gem "just-the-docs", github: "pdmosses/just-the-docs", branch: "nav-to-excluded"

See discussion just-the-docs#1566 for motivation.

Currently (v0.10.0) the cached site-nav used in the sidebar contains links only to pages that are not excluded from the main navigation.
When an excluded page is selected, the navigation path to any ancestors disappears.

This draft PR makes the cached site-nav used in the sidebar contain links to all pages, but adds the `nav-exclude` class to the HTML of links to excluded pages.
The CSS for the navigation then suppresses the display of those links, and the JS scrolls the navigation to the closest non-excluded ancestor link.

Preliminary testing with the Just-the-Docs-Tests repo was successful with JS enabled.
The generated page-specific CSS will need adjustment to give the same navigation when JS is disabled.
Rigorous testing will be needed to ensure that this should be a non-breaking change for non-customised sites.
* Suppress sass-embedded deprecation warnings
* Update all gems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant