Skip to content

new 'searchable' attribute on page entries - hidden files no longer searchable by default - #2976

Open
parmentelat wants to merge 5 commits into
jupyter-book:mainfrom
parmentelat:feat/2312
Open

new 'searchable' attribute on page entries - hidden files no longer searchable by default#2976
parmentelat wants to merge 5 commits into
jupyter-book:mainfrom
parmentelat:feat/2312

Conversation

@parmentelat

Copy link
Copy Markdown
Contributor

implements #2312

it is now possible to

  • keep any file (hidden or not) from being searchable
  • define a global policy (searchable or not) for hidden files

as a result the default behaviour changes for hidden files that previously were searchable
set hidden_files_searchable to true in the global site: config to obtain previous behaviour

Copilot AI review requested due to automatic review settings June 23, 2026 13:23
@changeset-bot

changeset-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 97e6989

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
myst-cli Minor
myst-toc Minor
myst-frontmatter Patch
myst-common Patch
myst-config Patch
myst-spec-ext Patch
mystmd Minor
myst-migrate Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the enhancement New feature or request label Jun 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds explicit control over whether pages are included in the generated site search index, addressing #2312 by making hidden pages non-searchable by default and introducing per-page overrides.

Changes:

  • Add searchable?: boolean to MyST TOC entry types and validator allowlist/validation.
  • Extend LocalProjectPage with hidden + searchable and filter myst.search.json generation based on per-page and site-wide policy.
  • Add a changeset documenting the new TOC field and site: config option hidden_files_searchable.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/myst-toc/src/types.ts Introduces searchable on common TOC entry metadata.
packages/myst-toc/src/toc.ts Accepts/validates searchable as a supported TOC key.
packages/myst-cli/src/project/types.ts Persists hidden/searchable on resolved project pages for downstream consumers.
packages/myst-cli/src/process/site.ts Implements search-index filtering logic and reads hidden_files_searchable from site config options.
.changeset/silent-doors-show.md Declares minor bumps and documents the behavior change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/myst-cli/src/process/site.ts
Comment on lines +172 to +178
function pageIsSearchable(page: LocalProjectPage, hiddenFilesSearchable: boolean): boolean {
// hidden or not, setting searchable explicitly wins
if (page.searchable !== undefined) return page.searchable;
// hidden pages fall back to the site-wide default
if (page.hidden) return hiddenFilesSearchable;
// general case: non-hidden pages are searchable
return true;
Comment thread packages/myst-cli/src/process/site.ts
Comment on lines 26 to +41
@@ -36,6 +36,10 @@ function validateCommonEntry(entry: Record<string, any>, opts: ValidationOptions
output.hidden = validateBoolean(entry.hidden, incrementOptions('hidden', opts));
}

if (defined(entry.searchable)) {
output.searchable = validateBoolean(entry.searchable, incrementOptions('searchable', opts));
}
searchable set on a file wins in all cases
if not set:
  non hidden files are searchable
  hidden files resort to site-wide hidden_files_searchable (default false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants