-
Notifications
You must be signed in to change notification settings - Fork 257
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
Rewrite URLs in imported WXR files to avoid broken navigation links (white screen, errors, nested Playground) #1780
Comments
When I navigate around the site not using the links in the navigation block, the pages load consistently. Screen.Recording.2024-09-18.at.14.51.42.movAt the end of the video, you see me click on the Home link in the navigation, it actually loads another playground instance into the site. |
I'm wondering if these two could be related #349 This seems like a caching bug to me. |
Thank you @adamziel for setting me straight... Glad it was so easy to transfer. |
The default instance of playground uses a URL like https://playground.wordpress.net/scope:0.5198681762892301/?page_id=2 (TT4, Sample page in Header) On my site it only has the URL Is there a way for me to modify the URL in the Navigation space of my .xml file from relative links |
This is definitely related to scope. After the first load, the page is I think that there is an underlying problem because |
To something like https://playground.wordpress.net/scope:{somestring}/about-us? Great research @bph! You are right about the root cause being imported URLs that aren't rewritten. I'm not sure what's the best way to address this and will need to work with @adamziel and @brandonpayton on finding possible next steps. |
It looks like we are attempting to add the scope to the URL if it doesn't exist but that scope isn't used later by the browser or our code (I still don't know). |
I see a few directions here, but I'm not sure what to do.
|
I'm moving this to blocked until I get some feedback from @WordPress/playground-maintainers. |
@bgrgicak thank you so much for pushing this forward. This is actually also a problem when migrating sites to other servers, as absolute links need to have a search/replace function. If Playground can do it out of the box, there wouldn't be a need for me to modify the original site export file for images and links. And a two section of my tutorial could be cut could be cut. 🤔 Seems you have enough information to tackle this. Just want to mention that this is not only a hick-up in relation to the navigation block but happens with normal on page links, to be visible on the Templates page. Those also don't work.
|
@bph A proper resolution will take a few months. Is there a way you could ship that block without an absolute URL in the Longer answer: The imported WXR file contains this code:
Which is not rewritten by the WXR importer we're currently using. I'm not aware of a tool that we could use in Playground that would also could correctly handle that today. I'm planning to fork/build a WXR importer and bake in the URL rewriting using the plumbing we've been exploring for the past year [1] [2]. Once it matures, I'll want to propose it for WordPress core. [1] https://github.com/adamziel/site-transfer-protocol |
@adamziel thanks for looking into this again. I am a bit confused as to what you see as absolute link and relative link
|
So for the header navigation, the examples of how the theme Twenty-Twenty-Four works out of the box got me thinking. If I added all the pages and be deliberate with the page parent selection, the theme default navigation probably will work with the page list, create the submenus and some voodoo that is built into it. (voodoo = not entirely clear, how it works) So with the v2 blueprint and v2 content, I was able to get this part working. Screen.Recording.2024-09-27.at.17.37.35.movIn the video you can see that all link from the top navigation have a scope assigned and load pages from a virtual (or how you want to call it) directory. It works because I didn't create a custom navigation block. The automatism built into WordPress takes care of it. but it seems Playground already rewrites links and adds scope to the URLs. Next steps:
|
On this Playground site. I get intermittent success when using the navigation menu. One-page load works, subsequent page loads show a white screen.
The content is all working when I got to WP-admin > Pages and use the View of each page. But sometimes on link works, but then the next one doesn't.
The content and blueprint can be viewed in this repo.
Here is a video of my clicking around on the site.
Screen.Recording.2024-09-18.at.13.16.13.mov
The text was updated successfully, but these errors were encountered: