I believe ghost does not have this feature yet, so i post this as an idea
since my previous topic seem like it is impossible and almost looks like re-engineering ghost (from my point of view),
this make me think why can’t ghost have a service worker as default feature?
…AMP is best use with PWA…
so mobile visitor will start fast and stay fast on the ghost blog…
in case the visitor from the AMP version of blog post they read, they decide to read another blog post which will bring them to the non-AMP version of the blog, this service worker can improve user experience… in the AMP version of the blog, it should have amp-install-serviceworker
i know that ghost is open source which i can contribute, but to be honest, i just don’t want to break things since i don’t really skillful in JS…
image below is for reference
i hope this will be default feature in the next ghost update
I’m having a difficult time understanding both your previous inked post and this one.
As a site admin with self-hosted ghost, what specifically would a service worker do for me? What functionality or behavior are you trying to make happen? It’s difficult to understand what you’re trying to do or what you think should be happening, or how a service worker would help.
just want to improve performance
some reader might have unstable connection
we don’t want to spoil their mood right? having to wait just to read an article (well this had being solved with the AMP conversion)
and wait again to read previous blog post or the latest one (here i believe, when click to read on other blog post, user will go to non-AMP version of the website, which require some loading, we want them to read more right?)
people with reliable internet connection will say everything is fine
oh i see,theme won’t effect…noted
i thought it was like wordpress where update also can break the website…
by the way, is there any way to update ghost instead of using command line?
what i mean is a more user friendly…command line is more on developer i guess
In wordpress, themes have the same level of access as the WP-core. This means the theme is free to do whatever it wants. Conversely, in Ghost, themes only have access to basic logic execution, and minor retrieval requests. This means the theme is extremely limited in what it can do and how it can mess with your Ghost installation.
Not at the moment. As ghost is still quite young, there’s a lot of work being done to make Ghost more functional. There is some sparse work being done to make it possible, but it hasn’t gone way to far
Came here searching for PWA support. This is something I’m really interested in, I follow a few blogs that are PWAs and one great thing is the prompt to pin to your home screen. The big benefit could be basic offline support where posts or some amount of posts are cached (amp?).
This is something I may look at contributing to Casper in the future or at least providing a plug-in or add on to do it, because I think this is just a really nice performance and benefit to get out of the box.
In the tutorial there is a cache first strategy, but you could adapt the logic to always fetch and return the network response (when available) and only return the last cached response when offline(as fallback). I am planning on updating the post with this information.
Another thing you could try is implementing a cache expiration, you can find information about that. Here is an example
Unfortunately I think this service worker is not correct for Ghost, I was unable to find a working (or ready to use) one on the Web.
We need to modify the service worker for /ghost/* path, otherwise 500 errors will be encountered. /ghost/* should never be cached
I have had the opportunity to try for some time, but I have not been able to obtain the optimal configuration, something still creates problems for me.
Regarding the frontend, I can trigger the update of cached files changing the constants in the service worker
Just checked out the idea and referred Biron’s article to add PWA support to my ghost blog too. I also faced issues as reported by you. For me these two steps worked
New content not visible - Updated the service worker to use Network first strategy which means show cached files only when network call fails. And present an offline page if both fail.
500 Erros in ghost admin - Added a check in the service worker to ignore all admin calls