31 Oct 2022
Aiming to replace Stork for my Pelican-powered static site. !projects/notes
Asked question regarding support of Github Pages:
Setup
Requires Node.js with npx
.
Install from:
Not working with code snippet provided on Pagefind homepage.
Seems like an issue with CSS and JS paths.
Copied .js
and .css
files to Pelican theme/js
and theme/css
.
This works (currently Live), ie search input and output appear.. but empty.
404 on https://notes.nicolasdeville.com/_pagefind/pagefind-ui.css
(which I should have tried and figured out at the previous step!) - which means the standard Github Actions worfklow triggered by Github Pages does not include the folder when deploying? 🤔
Downloaded the Artifact (ie root folder content of the website on server) from Github Pages, and indeed the folder _pagefind
is not included, despite being present in the main
Github branch used as source for the default Github Actions workflow that generates Github Pages.
Confirmed that folders prefixed with _
do not get included in the build: https://github/orgs/community/discussions/23640
How to get it included?
Asked: https://github/CloudCannon/pagefind/discussions/126
02 Nov 2022
Working now, using:
npx -y pagefind --source "/Users/USER/path/to/folder/with/html/files" --bundle-dir pagefind
The last pagefind
argument defines the name of the folder to be created, overriding the default _pagefind
which did not work because Github Pages ignores folders prefixed with _
upon deployment.
output:
.
├── filter
├── fragment
├── index
├── pagefind-entry.json
├── pagefind-ui.css
├── pagefind-ui.js
├── pagefind.en_4dc9564564.pf_meta
├── pagefind.en_8ba44c3efa.pf_meta
├── pagefind.en_a9db73dbfe.pf_meta
├── pagefind.en_eca087938c.pf_meta
├── pagefind.en_fbece7798f.pf_meta
├── pagefind.js
├── wasm.en.pagefind
└── wasm.unknown.pagefind
Next steps:
- exclude folders from search index (eg
author
,tag
, etc..) - show only sections with results
- show categories without having to expand each
focus: true
on load- navigate results with keyboard
exclude folders from search index
Asked on Github:
05 Mar 2023 been in place and working well since Nov'.
Open
passing a search query via URL parameter
See:
"There's some discussion of this in #144 — it is possible but you'll need a small code snippet of your own to get the query from the URL 🙂"
let pagefind = new PagefindUI({ element: "#search" });
pagefind.triggerSearch("some search terms");