From 6b14441ffd06c195846587820b4e3a3264269619 Mon Sep 17 00:00:00 2001 From: Bryan Ward Date: Thu, 10 Sep 2026 12:18:47 -0700 Subject: [PATCH] fix: the public navbar shows no version badge 0.5.0 kept the lone centred badge the main docs site used to render when its navbar had no title. The public navbar is meant to be logo-only: the brand mark, search, the SiteActions slot and the toggle. The badge, like the title, now belongs to the developer variant alone, and the CSS that existed only to hide a lone badge on tablets goes with it. --- docusaurus/docs/reference/components.md | 4 ++-- docusaurus/docs/reference/exports.md | 4 ++-- src/css/custom.css | 9 --------- src/theme/Navbar/useVantageNavbar.js | 12 +++++++----- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/docusaurus/docs/reference/components.md b/docusaurus/docs/reference/components.md index d52e81d..b083ad4 100644 --- a/docusaurus/docs/reference/components.md +++ b/docusaurus/docs/reference/components.md @@ -53,8 +53,8 @@ renders the brand link with an href the site cannot change, and `PrimaryMenu` repeats the developer navbar's external buttons in the mobile drawer. The only input a site has is the `navbarLinks` option. -`Navbar/Logo` reads `siteConfig.title` (developer variant only) and -`siteConfig.customFields.projectVersion`. theme-classic renders the title inside +`Navbar/Logo` reads `siteConfig.title` and `siteConfig.customFields.projectVersion`, +both on the developer variant only; the public navbar shows neither. theme-classic renders the title inside the brand anchor, so the override hides it there with CSS and re-renders it as its own absolutely centred element, which is what lets the version badge sit next to it. A version without a leading `v` gets one added. diff --git a/docusaurus/docs/reference/exports.md b/docusaurus/docs/reference/exports.md index 2b56928..ce97fe0 100644 --- a/docusaurus/docs/reference/exports.md +++ b/docusaurus/docs/reference/exports.md @@ -80,8 +80,8 @@ The theme decides from `baseUrl`, and there is no override: | anything else | public | `https://docs.vantagecompute.ai/` | search, the `Navbar/SiteActions` slot, colour-mode toggle | The developer navbar centres `siteConfig.title` with the version badge beside -it. The public navbar shows only the badge, when `customFields.projectVersion` -is set. +it. The public navbar shows neither: it is the brand mark, search, the slot and +the toggle, and `customFields.projectVersion` is ignored there. Sites declare no `themeConfig.navbar` and no `themeConfig.footer`. A site that still does builds fine; the theme renders neither. diff --git a/src/css/custom.css b/src/css/custom.css index ed6e301..6e9af5a 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -2015,15 +2015,6 @@ article { } } -/* A site with no navbar.title still gets the version badge, alone in the - centre. Between 997 and 1024 that is a bare git hash beside the logo on a - tablet; hide it there. On wider screens the lone centred badge stays. */ -@media (max-width: 1024px) { - .navbar__center-title:not(:has(.navbar__center-title-text)) { - display: none; - } -} - /* ── Tablet landscape (997 to 1199) ────────────────────────────────── */ /* Docusaurus treats this band as desktop: a 300px sidebar, a right-hand TOC column and the article between them. At 1024 the article is 505px and the diff --git a/src/theme/Navbar/useVantageNavbar.js b/src/theme/Navbar/useVantageNavbar.js index e3082bf..1a99469 100644 --- a/src/theme/Navbar/useVantageNavbar.js +++ b/src/theme/Navbar/useVantageNavbar.js @@ -11,7 +11,12 @@ export function useVantageNavbar() { const {siteConfig} = useDocusaurusContext(); const {variant, logoHref, navbarLinks} = usePluginData('@vantagecompute/docusaurus-theme'); - const raw = siteConfig.customFields?.projectVersion; + // The developer navbar names the project beside its version, which is how + // a reader confirms they are on the version they think they are. The public + // navbar is logo-only: no title and no version badge, even when the site + // sets customFields.projectVersion. + const developer = variant === 'developer'; + const raw = developer ? siteConfig.customFields?.projectVersion : null; const version = raw ? String(raw).startsWith('v') ? String(raw) @@ -22,10 +27,7 @@ export function useVantageNavbar() { variant, logoHref, links: navbarLinks, - // The developer navbar names the project beside its version, which is - // how a reader confirms they are on the version they think they are. - // The public navbar is logo-only. - title: variant === 'developer' ? siteConfig.title : null, + title: developer ? siteConfig.title : null, version, }; }