SuperPWA Incorrect start_url et al under roots.io installation
-
Summary
We use a modified version of WordPress based on the roots.io installation where the WordPress core is in
/wp
while wp-content is in/wp-content
(as usual). This file structure causes the manifest and service worker js to be stored in the/wp
directory. By way of example, we’re seeing this as the href value of the manifest:/wp/superpwa-manifest.json
Since PWAs limit their ability to what is in the scope value of the manifest, pages that are not under
/wp
(which are none, except admin pages) are not seen as being part of the application.I see you’ve added
$tags = apply_filters( 'superpwa_wp_head_tags', $tags );
which was quite helpful for removing “/wp” from the link href and I assume I can use some other filter to manipulate the URL of the service worker but… It sure would be great if this either worked out of the box or there was an option for specifying the application root in the settings page.
Unrelated to this feature request, it would also be nice if the manifest and service worker were present on wp-login.php (which they currently are not).
And finally (also unrelated), I’m seeing URLs with backslashes in the manifest. Actually, all forward slashes are escaped. Is this necessary or a bug, or a conflict with some other plugin on my site?
Preconditions
- Install on a WordPress installation based on roots.io (where the WordPress core is in a subdirectory)
Steps to Reproduce
- Install the plugin
- Configure the plugin
- Test the site in Chrome Audits or just look at the HTML
Expected Result
- The application manifest and service worker are in the site root
Actual Result
- The application manifest and service worker are in the WordPress core folder (which, in my case, is a subfolder called “wp”)
Workaround
- Apply a filter using superpwa_wp_head_tags to manipulate the manifest URL
- Apply a filter using superpwa_sw_filename to manipulate the service worker URL (untested as I write this)
- Manually copy the service worker and manifest into the site root
- Copy both files into the site root
Thanks a lot for this otherwise excellent plugin. A huge help!
- The topic ‘SuperPWA Incorrect start_url et al under roots.io installation’ is closed to new replies.