From 7f0e33de14e5bedf81e45a75dc24c05f32b95267 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Thu, 16 Oct 2025 14:55:02 +0200 Subject: [PATCH 1/5] If `sidebar.logo` is not specified, keep it as `undefined` internally. (cherry picked from commit 526d074967770be7826d465fe3e2f6b8ca2e7da7) --- src/core/brand/brand.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/brand/brand.ts b/src/core/brand/brand.ts index 4ce1ba3b75..38c1d0c80c 100644 --- a/src/core/brand/brand.ts +++ b/src/core/brand/brand.ts @@ -344,9 +344,14 @@ export function resolveLogo( return logo; }; if (!spec) { + const lightLogo = findLogo("light", order); + const darkLogo = findLogo("dark", order); + if (!lightLogo && !darkLogo) { + return undefined; + } return { - light: findLogo("light", order) || findLogo("dark", order), - dark: findLogo("dark", order) || findLogo("light", order), + light: lightLogo || darkLogo, + dark: darkLogo || lightLogo, }; } if (typeof spec === "string") { From 08bd8d1a4d4b3c75772dc8d18f0af2d4286a87b5 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Thu, 16 Oct 2025 16:14:47 +0200 Subject: [PATCH 2/5] do not search for navLinkHref in the sidebar if it's the logo link (cherry picked from commit 0048d62fc1017f6dc64e09ac715186f4030c2257) --- src/project/types/website/website-navigation.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/project/types/website/website-navigation.ts b/src/project/types/website/website-navigation.ts index 31c8805fa7..2cc3001516 100644 --- a/src/project/types/website/website-navigation.ts +++ b/src/project/types/website/website-navigation.ts @@ -559,7 +559,8 @@ function navigationHtmlPostprocessor( const navLinkHref = navLink.getAttribute("href"); const sidebarLink = doc.querySelector( - '.sidebar-navigation a[href="' + navLinkHref + '"]', + '.sidebar-navigation a[href="' + navLinkHref + + '"]:not(.sidebar-logo-link)', ); // if the link is either for the current window href or appears on the // sidebar then set it to active From 67263ae606ee404f603bc8205028257c665ff35f Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Thu, 16 Oct 2025 16:25:25 +0200 Subject: [PATCH 3/5] logo param can be undefined so nil in Lua (cherry picked from commit 21ec8ba3d3083d00bae587a958bd72492542e0de) --- src/resources/filters/quarto-post/typst-brand-yaml.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/filters/quarto-post/typst-brand-yaml.lua b/src/resources/filters/quarto-post/typst-brand-yaml.lua index 5c2cb3e00e..3ca5be17bb 100644 --- a/src/resources/filters/quarto-post/typst-brand-yaml.lua +++ b/src/resources/filters/quarto-post/typst-brand-yaml.lua @@ -251,7 +251,7 @@ function render_typst_brand_yaml() end -- logo local logo = param('logo') - if not next(logo) then + if logo and not next(logo) then meta.logo = nil end local logoOptions = {} From 7c7ce2876e10c7570d5bb67eb656528250eff575 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Fri, 10 Oct 2025 20:45:20 +0200 Subject: [PATCH 4/5] Add test for no logo and active nav (cherry picked from commit a4f4cc3eff9862135b4ba9bf6f92db020bbd4c34) --- .../issue-13506-no-logo/.gitignore | 2 ++ .../issue-13506-no-logo/_quarto.yml | 22 +++++++++++++++++ .../issue-13506-no-logo/index.qmd | 24 +++++++++++++++++++ .../issue-13506-no-logo/page2.qmd | 20 ++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/.gitignore create mode 100644 tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/_quarto.yml create mode 100644 tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/index.qmd create mode 100644 tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/page2.qmd diff --git a/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/.gitignore b/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/.gitignore new file mode 100644 index 0000000000..ad293093b0 --- /dev/null +++ b/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/.gitignore @@ -0,0 +1,2 @@ +/.quarto/ +**/*.quarto_ipynb diff --git a/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/_quarto.yml b/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/_quarto.yml new file mode 100644 index 0000000000..f4f5aa2909 --- /dev/null +++ b/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/_quarto.yml @@ -0,0 +1,22 @@ +project: + type: website + +website: + title: "Issue 13506 - No Logo" + navbar: + left: + - text: "Section A" + href: index.qmd + - text: "Section B" + href: page2.qmd + sidebar: + - title: "Section A" + contents: + - index.qmd + - title: "Section B" + contents: + - page2.qmd + +format: + html: + theme: cosmo diff --git a/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/index.qmd b/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/index.qmd new file mode 100644 index 0000000000..c1ec37b54a --- /dev/null +++ b/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/index.qmd @@ -0,0 +1,24 @@ +--- +title: "Section A" +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'nav.navbar a.nav-link[href$="index.html"].active' + - 'nav.navbar a.nav-link[href$="page2.html"]:not(.active)' + - + - 'a.sidebar-logo-link' +--- + +## Section A + +This is Section A. When NO logo is configured in the sidebar, the navbar active +state should work correctly. The "Section A" navbar item should be active on this page. + +The bug (issue #13506): After PR #12996, `sidebar.logo` was normalized to +`{light: undefined, dark: undefined}`, making `if(sidebar.logo)` always true. +This created empty `` elements that interfered with +the navbar active state detection logic. + +See also: [Section B](page2.qmd) diff --git a/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/page2.qmd b/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/page2.qmd new file mode 100644 index 0000000000..ed4781e222 --- /dev/null +++ b/tests/docs/smoke-all/website-sidebar/issue-13506-no-logo/page2.qmd @@ -0,0 +1,20 @@ +--- +title: "Section B" +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'nav.navbar a.nav-link[href$="page2.html"].active' + - 'nav.navbar a.nav-link[href$="index.html"]:not(.active)' + - + - 'a.sidebar-logo-link' +--- + +## Section B + +This is Section B. The "Section B" navbar item should be active on this page, +demonstrating that the navbar active state detection works correctly without +empty logo links interfering. + +See also: [Section A](index.qmd) From b0bbc04dfcd6bbf2931f99e1c759f6de90e992ab Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Thu, 16 Oct 2025 17:12:07 +0200 Subject: [PATCH 5/5] Add changelog item about backport --- news/changelog-1.8.md | 1 + 1 file changed, 1 insertion(+) diff --git a/news/changelog-1.8.md b/news/changelog-1.8.md index 8763afde1e..b1771ca5f5 100644 --- a/news/changelog-1.8.md +++ b/news/changelog-1.8.md @@ -3,6 +3,7 @@ ## In this release - ([#13046](https://github.com/quarto-dev/quarto-cli/issues/13046)): Use new url for multiplex socket.io server as default for `format: revealjs` and `revealjs.multiplex: true`. +- ([#13506](https://github.com/quarto-dev/quarto-cli/issues/13506)): Fix navbar active state detection when sidebar has no logo configured. Prevents empty logo links from interfering with navigation highlighting. ## In previous releases