Open bglw opened 2 years ago
Partially implemented — Pagefind now supports --serve
but does not yet implement --watch
For me, running pagefind against my hugo site on my dev server should result in me being able to use it on that server. The ui js and css lives at _pagefind/pagefind/ which is in the public dir. Fine for live but not when running 'hugo server'. This cannot then be tested and makes the project fall at the starting line.
If it's super simple to set up on a development machine and I'm just too tired to figure it out, maybe there should be instructions on the 'getting started' pages.
Hello @psaikido 👋
With the standard steps and Hugo, Pagefind will only be seen on Pagefind's dev server, as Hugo serves from its own memory and not from the public directory. When running Pagefind with --serve
you'll get a Pagefind dev server to test the search with.
There is a way locally to get Pagefind visible through your Hugo dev server, but it requires a couple of extra steps. There's a good guide here from Bryce & Régis: https://www.brycewray.com/posts/2022/07/pagefind-quite-find-site-search/#update-2021-07-31
Champion! Those extra steps have helped and it's working now. The standard steps with pagefinder and hugo are for a live server since it outputs the index to 'public'. Hugo running locally gets its sources from 'static'. The help pages seem to assume that folks will go directly to live with no intermediate steps whatsoever. This seems unlikely and I'd suggest modifying the instructions at https://pagefind.app/docs/ especially where it says "bask in how easy that was to integrate" ;)
When developing locally, Pagefind could watch and host a directory, so that a new SSG build would get picked up and indexed automatically.