• Resolved raffjones

    (@raffjones)


    I’m doing some local Gutenberg development, using browsersync.

    The Classic editor, on rendering the edit screen for a page, shows the permalink correctly as //localhost:3000 – as the interception and rewriting of the dev URL happens on render of the HTML. If I edit the page and it shows “Post Updated” then the link goes correctly to //localhost:3000/my-page/.

    In Gutenberg, this does not happen. The URLs remain as the dev site URL, meaning that the View Post URLs, and the Preview buttons don’t work – they take you away from the browsersync enabled development environment.

    This is obviously because those URLs are being generated and injected directly by Javascript rather than rendered in the page HTML. I just don’t know how to resolve it.

    Does anyone know if there’s a way round this?

    • This topic was modified 5 years, 7 months ago by raffjones.
    • This topic was modified 5 years, 7 months ago by raffjones.
Viewing 3 replies - 1 through 3 (of 3 total)
  • I found the issue was, can you try and change your permalinks again and update, that should fix the problem, its giving an 404 error, so when u go to the permalinks area, and click on normal save, and go back and change it to some other ones, it should fix the problem.

    Thread Starter raffjones

    (@raffjones)

    Thanks, but no, this isn’t the issue. There are no 404s and no issues with the permalinks. This is about browsersync being unable to change the intended links from (for example) http://mysite.devsite to http://localhost:3000 because there is no link HTML being rendered during the page render.

    I suppose this is aimed at someone who is familiar with browsersync and how to handle a situation when the links are generated via Javascript – as that seems to be what’s causing the problem in Gutenberg.

    Like I say, everything is fine in the Classic Editor.

    Moderator Marius L. J.

    (@clorith)

    Hiya,

    I’ve not hit this snag often, but I did hit it once, I ended up just doing a MU-plugin for my own sake, it checks if the URL I’m visiting with is a localhost:3xxx one, and if it is filters site_url to ensure everything generating things based on the URL uses the right one.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Gutenberg “View post” and “Preview” links not working with browsersync’ is closed to new replies.