Build Script for Cloudflare and Hugo
In Cloudflare Pages → Project Settings → Build Configuration, I can set the Framework preset to Hugo, the Build command to hugo, and the Build output directory to public. That’s the default when selecting Hugo.
However, when using Pagefind, even though I can set the Build command to hugo && npx pagefind --site "public", it’s not quite satisfying. This is because, on every build, Cloudflare runs hugo, installs Pagefind, and then runs npx pagefind --site "public" again — which takes a long time.