Skip to content

Commit a6dd6c1

Browse files
committed
Allow logo: false to disable sidebar and navbar logo when _brand.yml
Schema and code fix to allow explicitly disabling sidebar and navbar logo when `_brand.yml` defines one. Includes smoke test.
1 parent 4e9aa4a commit a6dd6c1

13 files changed

Lines changed: 92 additions & 2 deletions

File tree

‎src/core/brand/brand.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ export function resolveLogo(
343343
}
344344
return logo;
345345
};
346+
if (spec === false) {
347+
return undefined;
348+
}
346349
if (!spec) {
347350
const lightLogo = findLogo("light", order);
348351
const darkLogo = findLogo("dark", order);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export async function websiteNavigationConfig(project: ProjectContext) {
133133

134134
// note no document-level customization of brand logo #11309
135135
const projectBrand = await project.resolveBrand();
136-
if (navbar) {
136+
if (navbar && navbar.logo !== false) {
137137
let navLogo = navbar.logo;
138138
if (navbar[kLogoAlt]) {
139139
if (typeof navLogo === "string") {

‎src/resources/schema/definitions.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2722,8 +2722,9 @@
27222722
- id: logo-light-dark-specifier
27232723
description: >
27242724
Any of the ways a logo can be specified: string, object, or light/dark object of
2725-
string or object
2725+
string or object. Use `false` to explicitly disable the logo.
27262726
anyOf:
2727+
- enum: [false]
27272728
- ref: logo-specifier
27282729
- object:
27292730
closed: true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.quarto/
2+
3+
/.quarto/
4+
**/*.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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
project:
2+
type: website
3+
theme:
4+
light: brand
5+
dark: brand
6+
website:
7+
navbar:
8+
logo: false
9+
sidebar:
10+
style: "docked"
11+
search: true
12+
contents:
13+
- index.qmd
14+
- conclusion.qmd
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
title: conclusion
3+
---
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: intro
3+
_quarto:
4+
tests:
5+
html:
6+
ensureHtmlElements:
7+
- []
8+
- ['a.navbar-brand-logo']
9+
---
10+
11+
This test verifies that setting `navbar.logo: false` disables the navbar logo
12+
even when `_brand.yml` defines a logo.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.quarto/
2+
3+
**/*.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

0 commit comments

Comments
 (0)