Hi everyone,
I’m following the tutorial provided by the WeWeb team to set up custom metadata for dynamic pages using a Cloudflare worker with a custom domain. The setup is working, but only partially.
The issue I’m encountering is that the solution only works when I refresh the page that should trigger the worker. If I navigate to this page from the homepage or any other part of the site, the worker doesn’t activate, and the metadata isn’t fetched or applied. However, when I manually refresh the page, everything functions correctly, and the worker performs as expected.
My impression is that this happens because the Weweb application is a SPA, so when you navigate from one page to another, the browser does not make a new HTTP request to the server. Instead, it handles the navigation on the client side (JavaScript) by managing states and simply changing the displayed content. This means that, unlike a full page load, the URL can change without the server (or the Worker) being notified. However, what intrigues me is that in the tutorial demo, it works even when navigating from the home page.
Has anyone experienced a similar issue or have any suggestions on how to ensure the worker triggers correctly when navigating to the page via internal site links, without needing a refresh?
Thanks in advance for any insights!