Skip to content

strange behavior when toc-location is left #11770

@ceisenhauer

Description

@ceisenhauer

Bug description

i'm not sure if some of this behavior is intentional, but it seemed a bit odd to me.

i have a quarto website where toc-location is set to left. for certain pages (for example, about), i don't need a toc and so i turn it off in the page specific yaml. in doing this, i noticed that the page content became noticeably off-centered to the right:
Image

i realized that this is because setting the page specific toc to false removes the quarto-margin-sidebar (where a toc on the right would normally appear) but not the quarto-sidebar that is added when toc-location: left (see image below). this would explain why removing the page specific toc on a website with toc-location: right leaves the resulting content centered (expected behavior) but a page with toc-location: left does not (unexpected behavior).
Image

in full honesty, i actually expected that when toc-location: left the quarto-margin-sidebar would simply be moved to the left side of the page rather than having a second sidebar added instead. the current system causes content to be centered in a different way on pages with left hand vs right hand tocs even on the pages where the toc is present, which seems a bit surprising.

is this behavior expected?

Steps to reproduce

files to reproduce the above screenshot example.

index.qmd:

---
title: "Example"
toc: false
---

Lorem ipsum odor amet, consectetuer adipiscing elit. Integer eleifend eu pretium curabitur posuere ante hac. Justo rutrum interdum in faucibus curabitur litora justo nibh pretium. Nisl nisi erat ullamcorper sodales curae. Lectus vestibulum proin accumsan placerat etiam lectus lacinia mattis. Mus montes convallis faucibus maximus integer accumsan. Parturient maecenas at felis posuere suspendisse tellus ultricies euismod. Fermentum vestibulum platea justo potenti; vestibulum natoque adipiscing. Egestas vel suscipit et diam diam nullam egestas dolor.

_quarto.yml:

project:
  type: website

website:
  title: "sidebar_example"
  navbar:
    left:
      - href: index.qmd
        text: Home

format:
  html:
    theme: cosmo
    toc: true
    toc-location: left

Expected behavior

by default i would expect that setting toc-location: left moves quarto-margin-sidebar to the left side of the page rather than adding a second sidebar. even if adding a second sidebar is deliberate, i would expect that toc: false on a specific page removes both sidebars to produce an output equivalent to having toc: false on a page of website where toc-location: right.

Actual behavior

moving toc-location to the left (for overall website) adds a second sidebar on the left side of the page rather than moving the existing sidebar to the left. when toc: false for a specific page on a website with left-hand side tocs only the right hand sidebar is removed, resulting in off-center page content.

Your environment

  • ide: vim 8.1 (rendering done in terminal)
  • os: linux ubuntu 20.04
  • quarto: 1.6.39

Quarto check output

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghtmlIssues with HTML and related web technology (html/css/scss/js)layout

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions