Skip to content

fix: render long reference sidebars once instead of on every page - #413

Merged
rich-iannone merged 7 commits into
mainfrom
fix-reference-sidebar-optimize
Oct 23, 2026
Merged

rich-iannone merged 7 commits into
mainfrom
fix-reference-sidebar-optimize

Conversation

@rich-iannone

@rich-iannone rich-iannone commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Quarto rebuilds a page's whole sidebar on every page that shows it. On a large API this takes much of the render time: for a large API's reference sidebar it could list about 1,500 links, and every reference page has to render it. This PR has Quarto render each long reference sidebar once and then copies it into the pages that show it.

Before rendering, each reference sidebar (reference, cli-reference, mcp-reference) is copied to a full gd-full-<id> sidebar. Only a one-page template shows that copy, and the original sidebar keeps just the links the navbar needs, so Quarto renders a short sidebar on each page. After rendering, a post-render script (share-sidebars.py) takes the full sidebar from the template and puts it into each page. It marks the page's link as current, opens the sections around it, restores the search crumbs Quarto takes from the sidebar, and removes the template from the site and sitemap.

Pages aren't edited: the sidebar is named through the directory's _metadata.yml, so freeze caches stay valid. Normal builds run this just before rendering, and versioned builds run it in each version's directory.

The output matches a plain Quarto render: every page is byte-identical, and the search index holds the same entries. On a 303-page site with a 300-link reference sidebar, quarto render went from 241 to 145s (about 40% faster). Larger sidebars should save more. Sites with short sidebars (such as this one, with 14, 32 and 24 links) render in about the same time as before. A full versioned build of the Great Docs site succeeded, with the full sidebar and the right current link on the API, CLI and MCP pages in every version.

@rich-iannone
rich-iannone requested a review from has2k1 October 22, 2026 22:51
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

📚 Preview this PR's docs locally

Fetch the just-built site and open it in your browser:

# this exact build
great-docs preview --run 39994553024

# or always the latest build for this PR
great-docs preview --pr 413
Auth & tips
  • Requires great-docs: pip install great-docs (or run via pipx/uvx).
  • Auth: run gh auth login then add --use-gh, or set GITHUB_TOKEN (needs Actions: read).
  • Jump to a page: add --path reference/index.html.
  • Latest vs exact: --pr <n> grabs the newest build; --run <id> pins this one.
  • Re-download: --refresh ignores the local cache.

@has2k1 has2k1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM.

Though I am surprised there is no related issue at quarto-cli.

@rich-iannone
rich-iannone merged commit 4591847 into main Oct 23, 2026
8 checks passed
@rich-iannone
rich-iannone deleted the fix-reference-sidebar-optimize branch October 23, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants