new 'searchable' attribute on page entries - hidden files no longer searchable by default - #2976
Open
parmentelat wants to merge 5 commits into
Open
new 'searchable' attribute on page entries - hidden files no longer searchable by default#2976parmentelat wants to merge 5 commits into
parmentelat wants to merge 5 commits into
Conversation
🦋 Changeset detectedLatest commit: 97e6989 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
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 |
There was a problem hiding this comment.
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?: booleanto MyST TOC entry types and validator allowlist/validation. - Extend
LocalProjectPagewithhidden+searchableand filtermyst.search.jsongeneration based on per-page and site-wide policy. - Add a changeset documenting the new TOC field and
site:config optionhidden_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 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 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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
implements #2312
it is now possible to
as a result the default behaviour changes for hidden files that previously were searchable
set hidden_files_searchable to
truein the globalsite:config to obtain previous behaviour