Skip to content

feat: hide version dropdown when on Repo page - #568

Merged
harivyasi merged 3 commits into
eln-v3-docsfrom
product-split
Aug 7, 2026
Merged

feat: hide version dropdown when on Repo page#568
harivyasi merged 3 commits into
eln-v3-docsfrom
product-split

Conversation

@harivyasi

Copy link
Copy Markdown
Member

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.

…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
harivyasi merged commit be6bded into eln-v3-docs Aug 7, 2026
1 check passed
@harivyasi
harivyasi deleted the product-split branch August 7, 2026 09:27
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.
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