Page doubles (_escaped_fragment_) since Kirby 4

Hello everyone,

I have updated one of my pages to Kirby 4 today.

The page was also previously stored at Seobility. Since the update, I now see that each page exists twice with identical content, namely with the addition “?escaped_fragment” in the address.

I have only found one post about this in the forum. The problem there was that the navigation contained href=“#!” instead of href=“#”. But this is not the case for me.

Does anyone have any ideas where the problem could lie?

Thank you very much!

I don’t think this has anything strictly to do with Kirby 4. Or Kirby in general.

The _escaped_fragment_ query parameter was, in the past, used by search engines to tell a web server that they wanted to see content for a certain URI fragment (the part after “#” in an URL) in Single Page Apps.

The server was then expected to prerender the SPA in the same state as when a user with Javascript enabled navigated to such an URL.

This was so because search engines didn’t run javascript and URI fragments can’t be requested otherwise via HTTP. This is no longer the case.

In short, when Google saw a link like /foo#!bar, it would request /foo?_escaped_fragment_=bar and it expected to see the same outcome as a user clicking on the /foo#!bar link.


It’s unclear where those links in your case come from…

  • If your site isn’t an SPA, you probably shouldn’t care too much and could add a canonical URL, by adding something like <link rel="canonical" href="<?= $page->url() ?>"> to your <head>.

  • If your site really is an SPA, you can chose to ignore the problem (since _escaped_fragment_ isn’t really used by anyone), or actually handle the request correctly by rendering the correct content by prerendering the website as requested.

1 Like

Thank you very much for the quick reply. I have not found the cause, but this mention in the area at least solves the problem.