-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for fully offline search like PWAs #59
Comments
I'm not particularly on top of PWAs, but I could definitely add an option for configuring that query parameter. That would let you specify a custom query parameter rather than using the timestamp automatically, but would still allow you to set a new parameter on each build if you ran into caching issues. I'll wire that up 🙂 |
@bglw that would be really helpful, then I can replace my google search with Pagefind and it will work fully offline too. |
Grand! I'll include that in the next release. |
Hi @geshan — unfortunately there wasn't a super simple way to drop this in with the latest release. This file is loaded on initialization before any options get passed to Pagefind in the browser, so there isn't a great way to connect this to a flag in a nice way. (and I'm hesitant to make it a build-time flag) For now, after running pagefind you could automatically patch out that query parameter each time: # Linux
pagefind && sed -i 's/?ts=${Date.now()}//g' public/_pagefind/pagefind.js
# MacOS
pagefind && sed -i '' 's/?ts=${Date.now()}//g' public/_pagefind/pagefind.js I will keep ruminating on this though and try find a better solution that I'm comfortable with 🙂 |
Sounds fine for now, thanks! |
It works for now and also works in GitHub Workflows. And yes, it needs a better solution. |
Ah, I had forgotten about this issue but I'll pencil in proper support soon! As of Pagefind 1.0, the file is not loaded on initialization, and passing options could totally influence this behavior, so I can certainly add an option to resolve this. I'll target the next release for that 🙂 |
this feature is important many people use lunr over pagefind because it works fully offline i maneged to cache everything on the pagefind folder even the entry.json but when it dose the ?ts= it dosen't work because it can't get date offline |
Pagefind is a great project and a boon to static/JAM stack websites.
I run a blog that is also a Progressive Web Application (PWA) and I thought as page find is fully client side it would work offline for a PWA. Unfortunately, that was not the case, the main blocker I found was the metadata timestamp call. I have made sure that all the
.pf_fragment
,.pf_index
,.pagefind
,pf_meta
files are cached by the service worker, still when the server is not there, the/_pagefind/pagefind.pf_meta?ts={current-ts}
fails and the search fails too. Is there a way to also be cached by the service worker so that the search works offline? May be not the latest index but whatever was cached. I may be oversimplifying it.Patch fix
If I force remove the
?ts={current-ts}
it kinda works fully offline, is there a way to remove it with a flag or something?The text was updated successfully, but these errors were encountered: