Doc
Search
Sugo search uses Pagefind. The search opens as an overlay panel from the header button.
Enable Search UI
In your root hugo.toml:
| |
If this is set to false, the search button and the search overlay are not rendered. More information can be found here.
Build Scripts (Pagefind)
Search index is generated by Pagefind from the built public folder. In this repo, scripts are in mysite/package.json:
| |
A small but important point: npm run dev only starts Hugo server. It does not generate Pagefind index.
Local Workflow
For local testing with working search:
| |
If you change content and want updated search results, run build again:
| |
Once you have build the search indexes, you can also just use the normal hugo server to get the hugo site running locally. All of this is, of course, for running locally. For how to manage the deployment, see here
Search Text and Labels
You can customize search text labels from [params.ui] in hugo.toml:
| |
What Gets Indexed
By default, Pagefind indexes page body text. In Sugo, extra metadata is also exposed for indexing from frontmatter:
titlesubtitledescriptiontypesectioncategoriestagsauthors
So search can match title/subtitle/tags/categories/authors as well as normal content text.
If Search Is Not Working
- Check
enableSearch = truein[params.features]. - Run
npm run buildsopublic/pagefindis generated. - Deploy the
public/pagefindfolder along with the rest ofpublicoutput.