Skip to content

Commit 1855032

Browse files
authored
Merge pull request #13922 from quarto-dev/fix/issue-13910
Support `logo: false` to disable sidebar/navbar logos with `_brand.yml`
2 parents 4e9aa4a + 0b5c779 commit 1855032

55 files changed

Lines changed: 402 additions & 45 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎news/changelog-1.9.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ All changes included in 1.9:
8282
- ([#13570](https://github.com/quarto-dev/quarto-cli/pull/13570)): Replace Twitter with Bluesky in default blog template and documentation examples. New blog projects now include Bluesky social links instead of Twitter.
8383
- ([#13716](https://github.com/quarto-dev/quarto-cli/issues/13716)): Fix draft pages showing blank during preview when pre-render scripts are configured.
8484
- ([#13847](https://github.com/quarto-dev/quarto-cli/pull/13847)): Open graph title with markdown is now processed correctly. (author: @mcanouil)
85+
- ([#13910](https://github.com/quarto-dev/quarto-cli/issues/13910)): Add support for `logo: false` to disable sidebar and navbar logos when using `_brand.yml`. Works in website projects (`sidebar.logo: false`, `navbar.logo: false`) and book projects (`book.sidebar.logo: false`, `book.navbar.logo: false`).
8586

8687
### `book`
8788

‎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/book/book-config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export async function bookProjectConfig(
192192
site[kSiteSidebar] = site[kSiteSidebar] || {};
193193
const siteSidebar = site[kSiteSidebar] as Metadata;
194194
siteSidebar[kSiteTitle] = siteSidebar[kSiteTitle] || book?.[kSiteTitle];
195-
siteSidebar[kSidebarLogo] = siteSidebar[kSidebarLogo] || book?.[kSidebarLogo];
195+
siteSidebar[kSidebarLogo] = siteSidebar[kSidebarLogo] ?? book?.[kSidebarLogo];
196196
siteSidebar[kSidebarLogoHref] = siteSidebar[kSidebarLogoHref] ||
197197
book?.[kSidebarLogoHref];
198198
siteSidebar[kSidebarLogoAlt] = siteSidebar[kSidebarLogoAlt] ||

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

Lines changed: 10 additions & 10 deletions
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") {
@@ -172,8 +172,8 @@ export async function websiteNavigationConfig(project: ProjectContext) {
172172
}
173173

174174
let sideLogo = sidebars[0].logo;
175-
if (sideLogo) {
176-
if (sidebars[0][kLogoAlt]) {
175+
if (sideLogo !== false) { // don't do anything logo processing when sidebar logo is opt-out
176+
if (sideLogo && sidebars[0][kLogoAlt]) {
177177
const alt = sidebars[0][kLogoAlt];
178178
if (typeof sideLogo === "string") {
179179
sideLogo = { path: sideLogo, alt };
@@ -198,14 +198,14 @@ export async function websiteNavigationConfig(project: ProjectContext) {
198198
// };
199199
// }
200200
}
201+
let logo = resolveLogo(projectBrand, sideLogo, [
202+
"medium",
203+
"small",
204+
"large",
205+
]);
206+
logo = logoAddLeadingSlashes(logo, projectBrand, undefined);
207+
sidebars[0].logo = logo;
201208
}
202-
let logo = resolveLogo(projectBrand, sideLogo, [
203-
"medium",
204-
"small",
205-
"large",
206-
]);
207-
logo = logoAddLeadingSlashes(logo, projectBrand, undefined);
208-
sidebars[0].logo = logo;
209209

210210
// convert contents: auto into items
211211
for (const sb of sidebars) {

‎src/resources/editor/tools/vs-code.mjs‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12174,8 +12174,13 @@ var require_yaml_intelligence_resources = __commonJS({
1217412174
},
1217512175
{
1217612176
id: "logo-light-dark-specifier",
12177-
description: "Any of the ways a logo can be specified: string, object, or light/dark object of string or object\n",
12177+
description: "Any of the ways a logo can be specified: string, object, or light/dark object of string or object. Use `false` to explicitly disable the logo.\n",
1217812178
anyOf: [
12179+
{
12180+
enum: [
12181+
false
12182+
]
12183+
},
1217912184
{
1218012185
ref: "logo-specifier"
1218112186
},
@@ -22703,7 +22708,7 @@ var require_yaml_intelligence_resources = __commonJS({
2270322708
"Alternative text for the logo, used for accessibility.",
2270422709
"Path or brand.yml logo resource name.",
2270522710
"Alternative text for the logo, used for accessibility.",
22706-
"Any of the ways a logo can be specified: string, object, or\nlight/dark object of string or object",
22711+
"Any of the ways a logo can be specified: string, object, or\nlight/dark object of string or object. Use <code>false</code> to\nexplicitly disable the logo.",
2270722712
"Specification of a light logo",
2270822713
"Specification of a dark logo",
2270922714
"Any of the ways a logo can be specified: string, object, or\nlight/dark object of string or object",
@@ -23772,6 +23777,10 @@ var require_yaml_intelligence_resources = __commonJS({
2377223777
short: "Shift heading levels by a positive or negative integer. For example,\nwith <code>shift-heading-level-by: -1</code>, level 2 headings become\nlevel 1 headings.",
2377323778
long: "Shift heading levels by a positive or negative integer. For example,\nwith <code>shift-heading-level-by: -1</code>, level 2 headings become\nlevel 1 headings, and level 3 headings become level 2 headings. Headings\ncannot have a level less than 1, so a heading that would be shifted\nbelow level 1 becomes a regular paragraph. Exception: with a shift of\n-N, a level-N heading at the beginning of the document replaces the\nmetadata title."
2377423779
},
23780+
{
23781+
short: "Schema to use for numbering pages, e.g.&nbsp;<code>1</code> or\n<code>i</code>, or <code>false</code> to omit page numbering.",
23782+
long: 'Schema to use for numbering pages, e.g.&nbsp;<code>1</code> or\n<code>i</code>, or <code>false</code> to omit page numbering.\nSee <a href="https://typst.app/docs/reference/model/numbering/">Typst\nNumbering</a> for additional information.'
23783+
},
2377523784
{
2377623785
short: "Sets the page numbering style and location for the document.",
2377723786
long: 'Sets the page numbering style and location for the document using the\n<code>\\setuppagenumbering</code> command.\nSee <a href="https://wiki.contextgarden.net/Command/setuppagenumbering">ConTeXt\nPage Numbering</a> for additional information.'
@@ -24903,11 +24912,7 @@ var require_yaml_intelligence_resources = __commonJS({
2490324912
"Disambiguating year suffix in author-date styles (e.g.&nbsp;\u201Ca\u201D in \u201CDoe,\n1999a\u201D).",
2490424913
"Manuscript configuration",
2490524914
"internal-schema-hack",
24906-
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019.",
24907-
{
24908-
short: "Schema to use for numbering pages, e.g.&nbsp;<code>1</code> or\n<code>i</code>, or <code>false</code> to omit page numbering.",
24909-
long: 'Schema to use for numbering pages, e.g.&nbsp;<code>1</code> or\n<code>i</code>, or <code>false</code> to omit page numbering.\nSee <a href="https://typst.app/docs/reference/model/numbering/">Typst\nNumbering</a> for additional information.'
24910-
}
24915+
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019."
2491124916
],
2491224917
"schema/external-schemas.yml": [
2491324918
{
@@ -25136,12 +25141,12 @@ var require_yaml_intelligence_resources = __commonJS({
2513625141
mermaid: "%%"
2513725142
},
2513825143
"handlers/mermaid/schema.yml": {
25139-
_internalId: 218561,
25144+
_internalId: 219129,
2514025145
type: "object",
2514125146
description: "be an object",
2514225147
properties: {
2514325148
"mermaid-format": {
25144-
_internalId: 218553,
25149+
_internalId: 219121,
2514525150
type: "enum",
2514625151
enum: [
2514725152
"png",
@@ -25157,7 +25162,7 @@ var require_yaml_intelligence_resources = __commonJS({
2515725162
exhaustiveCompletions: true
2515825163
},
2515925164
theme: {
25160-
_internalId: 218560,
25165+
_internalId: 219128,
2516125166
type: "anyOf",
2516225167
anyOf: [
2516325168
{

‎src/resources/editor/tools/yaml/all-schema-definitions.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎src/resources/editor/tools/yaml/web-worker.js‎

Lines changed: 15 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/resources/editor/tools/yaml/yaml-intelligence-resources.json‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5146,8 +5146,13 @@
51465146
},
51475147
{
51485148
"id": "logo-light-dark-specifier",
5149-
"description": "Any of the ways a logo can be specified: string, object, or light/dark object of string or object\n",
5149+
"description": "Any of the ways a logo can be specified: string, object, or light/dark object of string or object. Use `false` to explicitly disable the logo.\n",
51505150
"anyOf": [
5151+
{
5152+
"enum": [
5153+
false
5154+
]
5155+
},
51515156
{
51525157
"ref": "logo-specifier"
51535158
},
@@ -15675,7 +15680,7 @@
1567515680
"Alternative text for the logo, used for accessibility.",
1567615681
"Path or brand.yml logo resource name.",
1567715682
"Alternative text for the logo, used for accessibility.",
15678-
"Any of the ways a logo can be specified: string, object, or\nlight/dark object of string or object",
15683+
"Any of the ways a logo can be specified: string, object, or\nlight/dark object of string or object. Use <code>false</code> to\nexplicitly disable the logo.",
1567915684
"Specification of a light logo",
1568015685
"Specification of a dark logo",
1568115686
"Any of the ways a logo can be specified: string, object, or\nlight/dark object of string or object",
@@ -16744,6 +16749,10 @@
1674416749
"short": "Shift heading levels by a positive or negative integer. For example,\nwith <code>shift-heading-level-by: -1</code>, level 2 headings become\nlevel 1 headings.",
1674516750
"long": "Shift heading levels by a positive or negative integer. For example,\nwith <code>shift-heading-level-by: -1</code>, level 2 headings become\nlevel 1 headings, and level 3 headings become level 2 headings. Headings\ncannot have a level less than 1, so a heading that would be shifted\nbelow level 1 becomes a regular paragraph. Exception: with a shift of\n-N, a level-N heading at the beginning of the document replaces the\nmetadata title."
1674616751
},
16752+
{
16753+
"short": "Schema to use for numbering pages, e.g.&nbsp;<code>1</code> or\n<code>i</code>, or <code>false</code> to omit page numbering.",
16754+
"long": "Schema to use for numbering pages, e.g.&nbsp;<code>1</code> or\n<code>i</code>, or <code>false</code> to omit page numbering.\nSee <a href=\"https://typst.app/docs/reference/model/numbering/\">Typst\nNumbering</a> for additional information."
16755+
},
1674716756
{
1674816757
"short": "Sets the page numbering style and location for the document.",
1674916758
"long": "Sets the page numbering style and location for the document using the\n<code>\\setuppagenumbering</code> command.\nSee <a href=\"https://wiki.contextgarden.net/Command/setuppagenumbering\">ConTeXt\nPage Numbering</a> for additional information."
@@ -17875,11 +17884,7 @@
1787517884
"Disambiguating year suffix in author-date styles (e.g.&nbsp;“a” in “Doe,\n1999a”).",
1787617885
"Manuscript configuration",
1787717886
"internal-schema-hack",
17878-
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto’s default order\nis ‘knitr’, ‘jupyter’, ‘markdown’, ‘julia’.",
17879-
{
17880-
"short": "Schema to use for numbering pages, e.g.&nbsp;<code>1</code> or\n<code>i</code>, or <code>false</code> to omit page numbering.",
17881-
"long": "Schema to use for numbering pages, e.g.&nbsp;<code>1</code> or\n<code>i</code>, or <code>false</code> to omit page numbering.\nSee <a href=\"https://typst.app/docs/reference/model/numbering/\">Typst\nNumbering</a> for additional information."
17882-
}
17887+
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto’s default order\nis ‘knitr’, ‘jupyter’, ‘markdown’, ‘julia’."
1788317888
],
1788417889
"schema/external-schemas.yml": [
1788517890
{
@@ -18108,12 +18113,12 @@
1810818113
"mermaid": "%%"
1810918114
},
1811018115
"handlers/mermaid/schema.yml": {
18111-
"_internalId": 218561,
18116+
"_internalId": 219129,
1811218117
"type": "object",
1811318118
"description": "be an object",
1811418119
"properties": {
1811518120
"mermaid-format": {
18116-
"_internalId": 218553,
18121+
"_internalId": 219121,
1811718122
"type": "enum",
1811818123
"enum": [
1811918124
"png",
@@ -18129,7 +18134,7 @@
1812918134
"exhaustiveCompletions": true
1813018135
},
1813118136
"theme": {
18132-
"_internalId": 218560,
18137+
"_internalId": 219128,
1813318138
"type": "anyOf",
1813418139
"anyOf": [
1813518140
{

‎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

‎src/resources/schema/json-schemas.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3359,6 +3359,11 @@
33593359
},
33603360
"LogoLightDarkSpecifier": {
33613361
"anyOf": [
3362+
{
3363+
"enum": [
3364+
false
3365+
]
3366+
},
33623367
{
33633368
"$ref": "#/$defs/LogoSpecifier"
33643369
},

0 commit comments

Comments
 (0)