Page-level `sidebar: <id>` and `navbar: true` remove the site's sidebar and navbar
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- rust
调研方向
Start with resolve_website_value in crates/quarto-config/src/website.rs:39, then trace how page navigation values reach sidebar_for_page in crates/quarto-navigation/src/sidebar.rs:670 and resolve_navbar in crates/quarto-navigation/src/navbar.rs:417. Reproduce the reported cases with the supplied q2 render steps and check whether each page retains its site's configured navigation. Done means the reported sidebar: <id> and navbar: true cases match the expected Quarto 1 behavior.
由索引模型根据 Issue 内容生成。
描述
This issue was written by Claude while adding q2 support to Great Docs. The output shown comes from running each repro.
Bug description
In Quarto 1, a page picks one of the site's sidebars with sidebar: <id> in its front matter, and
navbar: true leaves the site's navbar in place. In q2, both options remove the navigation they
name.
sidebar: <id>: the page gets no sidebar.navbar: true: in a site with no sidebar, the page gets no navbar. In a site that also has a
sidebar, the page kept its navbar.
The cause looks like resolve_website_value (crates/quarto-config/src/website.rs:39). It merges a
page's top-level sidebar or navbar with website.sidebar or website.navbar, and the top-level
value wins. So the scalar replaces the site's whole sidebar or navbar definition:
sidebar_for_page(crates/quarto-navigation/src/sidebar.rs:670) reads the page's choice from
site-sidebar, notsidebar.resolve_navbar(crates/quarto-navigation/src/navbar.rs:417) treatsnavbar: trueas absent,
because "the plan drops this shorthand".
Great Docs puts sidebar: <id> on its API reference pages to give them the API sidebar, and on
user guide and recipe pages for theirs. Under q2 those pages lost their sidebars. Great Docs now
renames the key to site-sidebar and removes navbar: true before a q2 render.
Steps to reproduce
mkdir -p page-nav/sidebar page-nav/navbar && cd page-nav/sidebar
cat > _quarto.yml <<'EOF'
project:
type: website
website:
navbar:
left: [index.qmd, a.qmd]
sidebar:
- id: main
contents: [index.qmd, a.qmd]
EOF
printf -- '---\ntitle: Home\n---\n\nHome.\n' > index.qmd
printf -- '---\ntitle: A\nsidebar: main\n---\n\nA.\n' > a.qmd
q2 render
grep -c 'id="quarto-sidebar"' _site/index.html _site/a.html
cd ../navbar
printf 'project:\n type: website\nwebsite:\n navbar:\n left: [index.qmd, b.qmd]\n' > _quarto.yml
printf -- '---\ntitle: Home\n---\n\nHome.\n' > index.qmd
printf -- '---\ntitle: B\nnavbar: true\n---\n\nB.\n' > b.qmd
q2 render
grep -c 'id="quarto-header"' _site/index.html _site/b.html
Actual behavior
_site/index.html:1
_site/a.html:0
_site/index.html:1
_site/b.html:0
a.html has no sidebar, and b.html has no navbar. With site-sidebar: main in a.qmd, the
sidebar appears. Without navbar: true in b.qmd, the navbar appears.
Expected behavior
As in Quarto 1.9.37:
_site/index.html:1
_site/a.html:1
_site/index.html:1
_site/b.html:1
- Read a page's string
sidebaras the id of the sidebar to use, assite-sidebaris read now,
rather than merging it overwebsite.sidebar. - Read a page's
navbar: trueas "keep the site's navbar". Onlyfalseshould turn it off.
If q2 drops these forms on purpose, a warning when a page uses them, and a note in the Quarto 1
differences docs, would help. Right now the navigation just disappears.
- 主要语言
- Rust
- 星标
- 302
- 派生
- 22
- 平均合并
- 5 小时 2 分钟
- 30 天内合并 PR
- 213
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
quarto-dev/q2 的其他 Issue
-
`dir: rtl` isn't written to `<html>` in HTML output可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
quarto-dev/q2#1219 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
quarto-dev/q2#1188 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
quarto-dev/q2#1179 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
quarto-dev/q2#1133 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
quarto-dev/q2#1103 · 1 条评论 ·
维护者通常 1 天内回复