Can't fetch pagefind files in public directory

I’m currently trying to use pagefind in my hugo site.
I followed indexing pagefind with npx pagefind --site public and have confirmed that there are files created under ‘public/pagefind’ directory.

However, when I start the server with hugo server and goto my “search” page where the html will try to fetch js and css files with the url like “http://localhost:1313/pagefind/pagefind-ui.css” , it cannot fetch and gets 404

I thought that if the files are under the ‘public’ dir were supposed to be accessable since they are considered as static files.

What could I have done wrong? Any suggestions are very welcome

Hi @chadrick ,

can we see your code somewhere on a public repo?
This would help you to get relevant answers in a timely manner

See also this part of the official documentation:

We’ll also add --serve so that we can view our final site right away.

npx -y pagefind --site public --serve

hugo serve does not serve files from /public. This has been discussed on the forum before, so if you want details, I suggest you do a search.