Search
Configure and understand Docgo's generated static search index and keyboard-driven search modal.
Docgo includes built-in client-side search.
export default defineConfig({
search: true,
});Search is enabled by default.
Build output
When search is enabled, Docgo writes:
dist/assets/search-index/en/latest.jsonEach record contains:
{
"route": "/guide/getting-started",
"title": "Getting Started",
"section": "Install Docgo",
"text": "Plain text extracted from the rendered page"
}Docgo writes one page-level record and additional section-level records for headings that have body content. Section records link directly to the matching heading hash, so results can open the relevant part of a page.
Search UI
The header renders a search button. Readers can open search with:
Ctrl KOn macOS, Command K also works because the handler checks the platform meta key.
Search scope
Docgo writes a separate index for each locale/version pair. A reader on
/ko/v1/... loads only assets/search-index/ko/v1.json, so unrelated
translations and versions are not downloaded or ranked.
Ranking
Docgo uses a small static ranking strategy:
- title matches receive the highest weight
- section heading matches are ranked above body matches
- body text matches are included
- multiple search terms must all be present in a result
- results are sorted by score
- the modal shows up to 12 matches
This keeps the search bundle simple and static-host friendly.
Custom search providers
The built-in search is intentionally small. If you want to use an external open-source search engine such as Pagefind, Orama, or FlexSearch, configure a custom provider.
export default defineConfig({
search: {
provider: 'custom',
component({ locale, version, indexPath }) {
return (
<button
type="button"
className="my-search-button"
data-locale={locale}
data-version={version}
data-index={indexPath}
>
Search
</button>
);
},
},
});With provider: 'custom', Docgo renders your component in the header instead
of hydrating the built-in search modal. Docgo still writes a locale/version
specific index by default, so your custom UI can reuse the generated page and
section records.
You can move the generated index:
export default defineConfig({
search: {
index: { path: 'search/docgo-index.json' },
},
});Or disable Docgo's search index completely when another tool owns indexing:
export default defineConfig({
search: {
provider: 'custom',
index: false,
component() {
return <div id="pagefind-search" />;
},
},
});Disable search
export default defineConfig({
search: false,
});When disabled, Docgo removes the header search control and does not write the search index.
