Skip to content

Site Editor & Blocks: Navigation and other page links aren't relative anymore & can break with changes to primary domain #94034

Open

Description

Quick summary

Right now when someone changes their site's primary address, links in (site editor) site navigation, (block) buttons, and (block based) gallery items are not updated, and will continue to point to the old address. This can cause the site to break.

As far as I'm aware, this has not always been the case: in the past, unless users hard-coded the links themselves (usually copy-pasting a page link instead of using the page link tool) the site would gracefully update navigation and other links to a new address. I don't know whether they used relative links or whether our system used to just add the correct primary site link when generating the html, but I don't remember navigation and other links like this breaking with URL changes before.

unrelative.mov

Steps to reproduce

  1. Start by connecting a custom domain with a simple site.

  2. Add a few things: custom navigation linking to specific pages, a gallery with images that link to attachment pages, and a button that links to the contact page. You might notice the links appear to show relative urls, like /contact, which should work with an address change.
    Screenshot 2024-08-29 at 2 03 49 PM

  3. Publish your work

  4. Disconnect the custom domain, so the site is on its free address.

You could also start with one free address, then rename to some other free address.

What you expected to happen

I would expect navigation, buttons, and media links within the site that are not intentionally hard-coded to link to the current primary domain, so that the site will continue to work even if the user changed the site address.

What actually happened

Any navigation item, image with attachment page link, or button link within the site that was set up with the old address will stay on the old address, thus breaking the site if the old name stops working.

Impact

Some (< 50%)

Available workarounds?

Yes, difficult to implement

If the above answer is "Yes...", outline the workaround.

Search all posts, pages, and templates within the site for the old address, and replace it by hand. Or, if we have access to a find-and-replace script we could update that way.

If on Atomic, a CLI search replace like this can help (be sure to remove dry run after confirming it's correct)
search-replace "olddomain.wpcomstaging.com" "newdomain.com" --skip-columns=guid --dry-run

Platform (Simple and/or Atomic)

Simple (including transfers from atomic)
Atomic (I haven't tested but did run into a case today; note @arthur791004 tested and wasn't able to replicate it on atomic)

Logs or notes

I didn't have time to test in Atomic, but it is less of an issue there because we do have find/replace options available to swap old addresses for new.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions