Skip to content

Behavior of arrays of sidebars is unclear #11870

@cwickham

Description

@cwickham

Opening after talking to @cscheid

This may be a bug or documentation issue, but consider this callout on the Webpage Nav docs:

A page that doesn’t appear in any sidebar will inherit and display the first sidebar without anid or title - you can prevent the sidebar from showing on a page by setting sidebar: false in its front matter.

This implied to me that the sidebar displayed on a page (unless otherwise set with sidebar in the header) would be:

  1. The sidebar in which it is an element
  2. If not an element in any sidebar, the first sidebar without a title (or id)

Here's an example that doesn't seem to follow these rules.

Consider this sidebar:

website:
  sidebar:
    - title: Research
      contents:
        - project-1.qmd
        - project-2.qmd
    - title: Teaching
      contents: 
        - course-1.qmd
        - course-2.qmd
    - contents:
        - index.qmd
        - about.qmd

I would expect that project-1.qmd would get the "Research" sidebar, and course-1.qmd to get the "Teaching" sidebar. Instead, they both get the last sidebar.

I've documented this example, and many others (some that almost work, some that don't) at: https://github.com/cwickham/sidebar-array?tab=readme-ov-file#sidebar-behavior

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions