[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

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 and npx 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.