Skip to content

Commit 44e7121

Browse files
committed
Preserve brand logo resolution for first sidebar
Only skip logo normalization for secondary sidebars (i > 0) so the first sidebar still resolves brand logos via resolveLogo when no explicit logo is set. Add brand-multi-sidebar test fixture verifying brand logos render on both sidebars without explicit logo config.
1 parent f464f34 commit 44e7121

7 files changed

Lines changed: 68 additions & 2 deletions

File tree

src/project/types/website/website-shared.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ export async function websiteNavigationConfig(project: ProjectContext) {
171171
sidebars[0].tools = [];
172172
}
173173

174-
for (const sb of sidebars) {
175-
if (sb.logo === undefined) continue; // let propagation handle inheritance
174+
for (let i = 0; i < sidebars.length; i++) {
175+
const sb = sidebars[i];
176+
// Secondary sidebars without explicit logo inherit from the first via propagation
177+
if (i > 0 && sb.logo === undefined) continue;
176178
let sideLogo = sb.logo;
177179
if (sideLogo !== false) { // don't do anything logo processing when sidebar logo is opt-out
178180
if (sideLogo && sb[kLogoAlt]) {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.quarto/
2+
**/*.quarto_ipynb
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
color:
2+
background:
3+
light: "#fff"
4+
dark: "#111"
5+
foreground:
6+
light: "#111"
7+
dark: "#fff"
8+
logo:
9+
medium:
10+
light: sun-face.png
11+
dark: moon-face.png
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
project:
2+
type: website
3+
theme:
4+
light: brand
5+
dark: [brand, dark-fixups.scss]
6+
website:
7+
sidebar:
8+
- title: "Group 1"
9+
style: "docked"
10+
contents:
11+
- index.qmd
12+
13+
- title: "Group 2"
14+
style: "docked"
15+
contents:
16+
- page.qmd
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*-- scss:rules --*/
2+
3+
nav.sidebar.sidebar-navigation:not(.rollup) {
4+
background-color: #282b30;
5+
}
6+
7+
nav.navbar {
8+
background-color: rgba(13, 108, 251, 25%);
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: "Group 1 Page"
3+
_quarto:
4+
tests:
5+
html:
6+
ensureHtmlElements:
7+
-
8+
- 'img[class*="light-content"][src="./sun-face.png"]'
9+
- 'img[class*="dark-content"][src="./moon-face.png"]'
10+
- []
11+
---
12+
13+
First sidebar with no explicit logo. Brand logo should be resolved for sidebar 1.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: "Group 2 Page"
3+
_quarto:
4+
tests:
5+
html:
6+
ensureHtmlElements:
7+
-
8+
- 'img[class*="light-content"][src="./sun-face.png"]'
9+
- 'img[class*="dark-content"][src="./moon-face.png"]'
10+
- []
11+
---
12+
13+
Second sidebar with no explicit logo. Brand logo should be inherited from sidebar 1.

0 commit comments

Comments
 (0)