Skip to content

Commit 4ee3e32

Browse files
committed
Revert "Merge pull request #9741 from quarto-dev/website/sidebar-global"
This reverts commit 7d24d71, reversing changes made to 024b610.
1 parent 378a8c8 commit 4ee3e32

File tree

23 files changed

+9
-184
lines changed

23 files changed

+9
-184
lines changed

news/changelog-1.5.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ All changes included in 1.5:
6161
- ([#8977](https://github.com/quarto-dev/quarto-cli/issues/8977)): Don't decorate about links within external link icons.
6262
- ([#8986](https://github.com/quarto-dev/quarto-cli/issues/8986)): Search: only build subfuse index when it's safe to do so.
6363
- ([#9356](https://github.com/quarto-dev/quarto-cli/issues/9356)): Don't process column classes for figures inside the About divs.
64-
- ([#9741](https://github.com/quarto-dev/quarto-cli/issues/9741)): Sidebar is correctly shown globally when title is used in the `sidebar` configuration.
6564
- ([#9781](https://github.com/quarto-dev/quarto-cli/issues/9781)): Correctly hide elements from click event in collapsed margin sidebar.
6665

6766
## Book

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,6 @@ export async function websiteNavigationExtras(
288288
const href = target?.outputHref || inputFileHref(inputRelative);
289289
const sidebar = sidebarForHref(href, format);
290290

291-
// if the sidebar has a title and no id generate the id
292-
if (sidebar && sidebar.title && !sidebar.id) {
293-
sidebar.id = asHtmlId(sidebar.title);
294-
}
295-
296291
// Forward the draft mode, if present
297292
const draftMode = projectDraftMode(project);
298293

@@ -1008,6 +1003,11 @@ async function sidebarsEjsData(project: ProjectContext, sidebars: Sidebar[]) {
10081003
async function sidebarEjsData(project: ProjectContext, sidebar: Sidebar) {
10091004
sidebar = ld.cloneDeep(sidebar);
10101005

1006+
// if the sidebar has a title and no id generate the id
1007+
if (sidebar.title && !sidebar.id) {
1008+
sidebar.id = asHtmlId(sidebar.title);
1009+
}
1010+
10111011
// ensure title and search are present
10121012
sidebar.title = sidebarTitle(sidebar, project) as string | undefined;
10131013
sidebar.logo = resolveLogo(sidebar.logo);

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,21 +342,20 @@ export const navigation: Navigation = {
342342
};
343343

344344
export function sidebarForHref(href: string, format: Format) {
345-
const sidebars = ld.cloneDeep(navigation.sidebars) as Sidebar[];
346345
// if there is a single sidebar then it applies to all hrefs
347346
// (unless it has an id, in which restrict it)
348347
if (
349-
sidebars.length === 1 && sidebars[0].id === undefined
348+
navigation.sidebars.length === 1 && navigation.sidebars[0].id === undefined
350349
) {
351-
return sidebars[0];
350+
return navigation.sidebars[0];
352351
} else {
353-
const explicitSidebar = sidebars.find((sidebar) => {
352+
const explicitSidebar = navigation.sidebars.find((sidebar) => {
354353
return sidebar.id === format.metadata[kSiteSidebar];
355354
});
356355
if (explicitSidebar) {
357356
return explicitSidebar;
358357
} else {
359-
const containingSidebar = sidebars.find((sidebar) => {
358+
const containingSidebar = navigation.sidebars.find((sidebar) => {
360359
return containsHref(href, sidebar.contents);
361360
});
362361
if (containingSidebar) {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/docs/smoke-all/website/sidebar/sidebar-title-external-links/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/docs/smoke-all/website/sidebar/sidebar-title-external-links/_quarto.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/docs/smoke-all/website/sidebar/sidebar-title-external-links/about.qmd

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)