Open itamarst opened 2 years ago
Hi @itamarst 👋
If you do land with a good code sample I could look at adding some SSG specific guides to the documentation. The recommended way to run Pagefind is after your primary build, so usually more along the lines of changing your build command to:
bundle exec jekyll build && pagefind --source _site
Happy to document options though so let me know if you resolve any issues you're having with your setup and I can look at the docs 🙂
The above essentially does it after the build, just, automatically. The problem is probably actually #77.
Updated above to note that actually works. Very slick build, in general!
The final version I went with was:
Jekyll::Hooks.register :site, :post_write do |site|
system("npx -y pagefind --source '%{path}'" % {:path => site.dest})
end
which has the benefit of Just Working on Netlify (and any computer with npx installed).
Awesome — I have some docs work to do soon and I'll look at adding some SSG tips 🙂
Not really a problem here because the input is relatively safe but you want to avoid calling into the shell.
Something like the following should probably work
system "npx", "-y", "pagefind", "--source", site.dest
It would be useful to have this documented.
For reference, I've gotten it working by adding a file called
pagefind.rb
to_plugins/
with the following contents: