Search
This theme includes built-in search functionality powered by Pagefind, a fast static search library that indexes your site content.
Enabling/Disabling Search
Control the search icon visibility in your params.toml
| |
Setup & Commands
When Search is Disabled (showSearchIcon = false)
You can use standard Hugo commands without any additional setup:
| |
No additional dependencies or configuration required.
When Search is Enabled (showSearchIcon = true)
Search requires Pagefind to index your site content. Follow these steps:
1. Pagefind Wrapper (Recommended)
First, ensure you have Node.js installed, then initialize a Node.js project with:
| |
This creates a basic node.js project on your root and creates a package.json file. In the package.json file replace the scripts with :
| |
2. Install Pagefind Globally
You can also install pagefind binaries directly if you do not want to use the wrapper. This is not recommended generally.
| |
For Local Development:
| |
This command:
- Builds Hugo to the
publicfolder - Runs Pagefind to index content
- Starts Hugo server with drafts enabled
For Production Build:
| |
This command:
- Builds Hugo to the
publicfolder - Runs Pagefind to index content
- Output is ready for deployment
Simple Server (without rebuilding index):
| |
Use this when you’ve already built the Pagefind index and just want to preview.
Important Notes
Always Use the public Folder
Pagefind is configured to:
- Read from:
public(Hugo’s build output) - Write to:
public/pagefind(search index location)
Do not change the output directory — the theme expects the search index at /pagefind/.
How It Works
- Hugo builds your site to
public/ - Pagefind scans
public/and creates a search index - The search index is saved to
public/pagefind/ - When deployed, the search UI loads this index automatically
What is indexed for search ?
Only those .md files which are considered posts are indexed by pagefind. If you .md files of type page, they will not be indexed and will not appear in search results.
If you want a page that appears in search you can use the following workaround in your frontmatter.
| |
Deployment
When deploying to platforms like Netlify, Vercel, or GitHub Pages, use the build command:
| |
Or configure your platform’s build command to:
| |
More about deployment here.