Hugo Profile includes client-side full-text search powered by a JSON index generated at build time. No external search service or API key is required — the search index is built by Hugo and queried entirely in the browser usingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/gurusabarish/hugo-profile/llms.txt
Use this file to discover all available pages before exploring further.
search.js.
How It Works
When Hugo builds your site, it generates anindex.json file at the site root by iterating over all regular content pages. The search.js script fetches this file on demand and filters results by matching the user’s query against each page’s title, description, and content fields. Results appear as a dropdown overlay anchored below the search input in the navbar.
The search is debounced with a 300 ms delay so the index is only queried after the user pauses typing, keeping performance smooth even on larger sites.
Enabling and Disabling Search
Search is enabled by default. To disable it, setparams.navbar.disableSearch to true in your hugo.yaml:
Customizing the Placeholder Text
Override the default"Search..." placeholder with params.navbar.searchPlaceholder. If this param is not set, the theme falls back to the i18n string search_placeholder:
Required Output Configuration
For search to work, Hugo must generate the JSON index at build time. Ensure yourhugo.yaml includes "JSON" in the outputs.home list:
Search Index Format
Theindex.json template (layouts/_default/index.json) iterates over all pages recursively and serializes each one as a JSON object. The raw template that produces this output is:
index.json contains:
| Field | Source |
|---|---|
title | Page title |
description | description frontmatter |
content | Full rendered HTML |
image | image frontmatter |
permalink | Absolute URL to the page |
Search Behaviour
- Scope — all pages under
content/are indexed, including blog posts, gallery entries, and any other regular content. - Drafts — pages marked
draft: trueare excluded from Hugo builds and therefore never appear inindex.json. - Matching — the query is matched case-insensitively against
title,description, andcontent. A page is included in results if any of those fields contain the query string. - Results UI — matching results are shown as a dropdown card list below the search box. Each card links to the matching page and shows its title and description.
The search index is fetched once per search session and cached in memory for subsequent queries on the same page load. Navigating to a new page resets the cache.