Skip to content

The hide_toc and hide_search options are declared and documented but have no effect #213

Description

@mmcky

Problem

The theme declares two layout options, hide_toc and hide_search. The docs say they hide the contents drawer and its toolbar toggle, and the toolbar search control, either site-wide or on one page. Nothing acts on either value. Set either one to true in site.options, or under site: in a page's frontmatter, and the page still renders the contents drawer (a closed popover), its "Table of contents" toggle and the "Search" trigger.

Page.tsx reads both values and passes them to NavigationAndArticleWrapper, and the next component down drops them. The trace below is from the code at d504555:

Step Code What happens
Declared template.yml L99-L105, app/types.ts L8-L11 Both are boolean options, valid site-wide or per page
Documented docs/configuration.md L26-L27, docs/layout.md L18-L19, README.md L238-L245 "hide the contents drawer and its toggle" and "hide the search control"
Read app/components/Page.tsx L19-L30 Merges the page's site: block over site.options, then passes hide_toc and hideSearch={hide_search} to NavigationAndArticleWrapper
Forwarded NavigationAndArticleWrapper.tsx L31-L47 The exported wrapper passes both props to the internal component
Dropped NavigationAndArticleWrapper.tsx L10-L21 The internal component types both props but destructures only children, and renders <Toolbar /> and <ContentsSidebar /> with no props
Toggle and search always render Toolbar.tsx L18-L22, L43-L45, L63-L65 Toolbar() takes no props, and <SidebarToggle /> and <Search /> render unconditionally
Drawer always renders ContentsSidebar.tsx L78-L85, L113-L117 ContentsSidebar() takes no props and returns null only when there is no site manifest. Otherwise it renders the popover drawer

No other code acts on the values. A git grep for hide_toc, hide_search and hideSearch at d504555 finds no other reader in app/. In @myst-theme/site 1.3.0, only TopNav, Navigation and PrimarySidebar take these flags, and the theme imports none of them.

The CLI drops every site.options key that the template does not declare (see #173). Neither option was declared until #194, which shipped in v2.7.0 (CHANGELOG.md L70-L81). Before that, a site-wide value never reached the theme. Now it arrives and nothing uses it. A page's site: block is checked against the same declarations (mystmd packages/myst-cli/src/frontmatter.ts L83-L91).

No test checks what either option does:

Scale: no lecture site is known to set either key. On 2026-09-11, GitHub code search across the QuantEcon organisation (default branches) found both keys only in this repository. The people affected are authors who follow the docs: the option passes validation, reaches the theme and silently does nothing.

Proposed change

Make both options work where the wrapper renders the page chrome:

  1. In NavigationAndArticleWrapperInternal, destructure hide_toc and hideSearch. Render <ContentsSidebar /> only when hide_toc is not set, and pass both flags to <Toolbar />.
  2. In Toolbar, leave out the <li> around <SidebarToggle /> when hide_toc is set, and the <li> around <Search /> when hideSearch is set. Another option is to keep the <li> and give it empty:hidden, as the toolbar's other optional slots do. Either way, avoid an empty <li>: the row spaces items with gap-x-*, so an empty <li> still takes a gap (Toolbar.tsx L36-L42).
  3. Not rendering <Search /> also removes the Cmd/Ctrl+K shortcut, because the component registers that listener itself (Search.tsx L617-L634). Upstream works the same way. @myst-theme/site 1.3.0 renders {!hideSearch && <Search />} (src/components/Navigation/TopNav.tsx line 170), and its Search registers the shortcut inside the component (src/components/Navigation/Search.tsx lines 614-631). Say this in docs/configuration.md.
  4. Add a Playwright test next to site-options. It should load a fixture page that sets both options to true under site: and assert there is no "Search" button, no "Table of contents" button and no drawer. It should also check that another fixture page still has all three.

app/components/ErrorPage.tsx L5-L18 mounts the wrapper with no props. With the change above, a site-wide value would not apply to 404 and error pages. Either pass the site-wide values there too, or say in the docs that error pages keep both controls.

Maintainers may prefer not to support these options. The consistent alternative is then to remove them from template.yml, app/types.ts, Page.tsx, the wrapper's props, docs/configuration.md, docs/layout.md, README.md, and the hide_search: false line in the fixture. #194 took that route for the never-read hide_outline, hide_title_block, hide_footer_links and outline_maxdepth.

Acceptance criteria

If the options are implemented (the proposed change):

  • hide_toc: true in site.options removes the contents drawer and the "Table of contents" toggle from every article page. Set under site: in one page's frontmatter, it removes them from that page only.
  • hide_search: true removes the "Search" trigger and the Cmd/Ctrl+K shortcut, site-wide or on one page in the same way.
  • With neither option set, the toolbar and drawer look and behave as they do today.
  • Hiding a control leaves no empty <li> and no extra gap in the toolbar row.
  • A Playwright test in the visual fixture fails if either option stops working.
  • docs/configuration.md, docs/layout.md and README.md describe the shipped behaviour, including the search shortcut and what error pages do.

If maintainers remove the options instead:

  • Neither key remains in template.yml, app/, docs/, README.md or tests/visual/fixture, and the CHANGELOG records the removal.

Context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is wrong or broken in a lecture or build

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions