feat: hide version dropdown when on Repo page - #568
Merged
Conversation
…ance Chemotion Repository is a separate product from the ELN with its own release cycle. It doesn't need a v2/v3 split -- it only had one because docs/repo lived inside the single versioned docs instance by accident of folder placement. Diffing docs/repo against the old versioned v2 copy showed only copyedit-level drift, confirming there was never any real content divergence to preserve. Moved docs/repo to repo-docs and registered it as a second @docusaurus/plugin-content-docs instance (id "repo", routeBasePath "repo", no `versions` config), per https://docusaurus.io/docs/docs-multi-instance. Because baseUrl is "/docs/" and the main instance's routeBasePath is "/", the public URLs are unchanged, so existing redirects and cross-links keep working. Deleted the versioned_docs/version-v2/repo copy outright. Since each plugin instance owns its own sidebar, two custom sidebarItemsGenerator functions keep the site feeling like one continuous sidebar instead of two disconnected ones: the main sidebar gets a "Chemotion Repository" link spliced in at its original position, and Repository's own sidebar mirrors the main site's top-level sections as plain links while its own content is nested under a proper "Chemotion Repository" category. Verified with a clean build and Playwright checks: correct sidebar structure and ordering on both the current and v2 docs, working cross-instance navigation, no broken links, and search still covers Repository content.
The docsVersionDropdown navbar item always renders when its target instance (the default/ELN instance) has more than one version, regardless of which docs plugin instance's pages are currently being viewed -- Docusaurus doesn't scope navbar items to a route, and setting docsPluginId explicitly doesn't change that (confirmed by reading DocsVersionDropdownNavbarItem.tsx). On /docs/repo/* pages (the separate, unversioned "repo" instance added in the previous commit) that left a "Version 3.x" dropdown that looks actionable but only ever navigates back into the ELN docs -- useless at best, misleading at worst. Fix is CSS-based rather than swizzling the navbar item component: src/clientModules/hideVersionDropdownOnRepo.js toggles a body class via Docusaurus's onRouteDidUpdate client lifecycle hook (fires on both hard page loads and client-side navigation) based on whether the current path is under /docs/repo, and src/css/custom.css hides the dropdown (now given a stable className) when that class is present. Verified via clean build + Playwright: hidden on both a hard load of /docs/repo and a client-side navigation into it, reappears when navigating to an ELN page (hard load or client-side), no layout gap left behind.
harivyasi
added a commit
that referenced
this pull request
Aug 7, 2026
The docsVersionDropdown navbar item always renders when its target instance (the default/ELN instance) has more than one version, regardless of which docs plugin instance's pages are currently being viewed -- Docusaurus doesn't scope navbar items to a route, and setting docsPluginId explicitly doesn't change that (confirmed by reading DocsVersionDropdownNavbarItem.tsx). On /docs/repo/* pages (the separate, unversioned "repo" instance added in the previous commit) that left a "Version 3.x" dropdown that looks actionable but only ever navigates back into the ELN docs -- useless at best, misleading at worst. Fix is CSS-based rather than swizzling the navbar item component: src/clientModules/hideVersionDropdownOnRepo.js toggles a body class via Docusaurus's onRouteDidUpdate client lifecycle hook (fires on both hard page loads and client-side navigation) based on whether the current path is under /docs/repo, and src/css/custom.css hides the dropdown (now given a stable className) when that class is present. Verified via clean build + Playwright: hidden on both a hard load of /docs/repo and a client-side navigation into it, reappears when navigating to an ELN page (hard load or client-side), no layout gap left behind.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docsVersionDropdown navbar item always renders when its target
instance (the default/ELN instance) has more than one version,
regardless of which docs plugin instance's pages are currently being
viewed -- Docusaurus doesn't scope navbar items to a route, and setting
docsPluginId explicitly doesn't change that (confirmed by reading
DocsVersionDropdownNavbarItem.tsx). On /docs/repo/* pages (the
separate, unversioned "repo" instance added in the previous commit)
that left a "Version 3.x" dropdown that looks actionable but only ever
navigates back into the ELN docs -- useless at best, misleading at
worst.
Fix is CSS-based rather than swizzling the navbar item component:
src/clientModules/hideVersionDropdownOnRepo.js toggles a body class via
Docusaurus's onRouteDidUpdate client lifecycle hook (fires on both hard
page loads and client-side navigation) based on whether the current
path is under /docs/repo, and src/css/custom.css hides the dropdown
(now given a stable className) when that class is present.
Verified via clean build + Playwright: hidden on both a hard load of
/docs/repo and a client-side navigation into it, reappears when
navigating to an ELN page (hard load or client-side), no layout gap
left behind.