quarto-dev / quarto-dev/quarto-cli

Behavior of arrays of sidebars is unclear

Open
#11,870 0 comments 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Jan 20, 2025.

website-navigation websites
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.