fix: draft pages appear in search results
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 1
- Avg merge
- 12h 29m
- Merged PRs (30d)
- 12
Description
Problem
`src/server/build-search-index.ts` indexes all .md/.mdx files without checking the `draft` frontmatter field. Pages marked as drafts are findable via search, leaking unpublished content.
The runtime search handler (`src/server/api/search.ts`) uses `getPagesForVersion()` which may already filter drafts, but the static index builder (`build-search-index.ts`) does its own file scanning without this check.
Suggested Fix
- Check `fm.draft === true` in `scanContent()` and skip those pages
- Verify the runtime `buildDocs()` in `search.ts` also excludes drafts (it uses `getPagesForVersion` → `getPages` which filters via `isDraft`)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/server/build-search-index.ts at scanContent(), then inspect src/server/api/search.ts and its buildDocs() path to confirm the runtime behavior. The work is done when pages with draft frontmatter are excluded from the static search index and runtime search remains consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100