• 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

    1. Install the plugin
    2. Configure the plugin
    3. 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!

    • This topic was modified 6 years, 1 month ago by tedmaster. Reason: Clarified some of the details around the sw.js and how I dealt with it
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tedmaster

    (@tedmaster)

    Bump…

    Jose Varghese

    (@josevarghese)

    Hello tedmaster,

    Good day and thanks for trying out Super Progressive Web Apps WordPress plugin.

    At this time our plugin is not compatible with roots as the structure of roots is entirely different than that of the WordPress. Our plugin writes the manifest and service worker file’s based after checking the Root of the WordPress installed folder. Due to that reason, I’m not sure whether a manual fix will resolve this at this time.

    Also would like to let you know that we are trying out a solution to make our plugin compatible with Roots. Hopefully you can expect it over our coming releases.

    Thread Starter tedmaster

    (@tedmaster)

    Thanks for the reply. I see you’re using network_site_url() to link to the service worker but perhaps you should be using network_home_url()? I don’t doubt you are excellent developers, just trying to move this along as it’s important for my particular project.

    For finding the installation root you can also use the technique shown here:
    https://xnau.com/finding-the-wordpress-root-path-for-an-alternate-directory-structure/

    If I’ve followed your code correctly, you only need to change lines 47 and 53 to allow it to work in a non-standard hierarchy. At present I’m using a combo of filters and actions to work around this but it’s not really maintainable and a definitive solution would be greatly appreciated.

    Kind regards,

    Ted Stresen-Reuter

    • This reply was modified 6 years ago by tedmaster. Reason: Clarified what changes need to be made
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘SuperPWA Incorrect start_url et al under roots.io installation’ is closed to new replies.