[Hugo] You must run npx pagefind everytime you build if you want to index your new posts
![[Hugo] You must run npx pagefind everytime you build if you want to index your new posts](/content/images/size/w1200/2025/07/puzzle-creative-RJtZiTbAy-c-unsplash.jpg)
1. Build your Hugo site (create/update /public
):
hugo
- This builds your static site in the
public/
directory.
2. Run Pagefind to index the site:
npx pagefind --site public
- This command creates the
/public/pagefind/
folder, which contains the JavaScript and CSS needed for the search UI.
Important:
- You must run both
hugo
andnpx pagefind --site public
every time you rebuild your site, every time you add, edit, or remove content in your Hugo site that you want to appear in search results, before deploying or serving from the/public
directory.