Serve dedicated HTML page to Google crawler without changing the URL to make for dynamic content

StackOverflow https://stackoverflow.com/questions/18015802

  •  04-06-2022
  •  | 
  •  

Question

My website is in javascript with dynamically generated content on top of a fixed HTML frame. To make Google aware of the content I use the _escaped_fragment_ trick and track on the server side when to serve fixed content instead of dynamic. It all works well for the sub pages as long as they are linked with #!, which is the case for all pages but the homepage.

I obviously want to keep the homepage without an ugly #! at the end of the URL.

So far the only solution I can think of is to serve the homepage with fixed content instead of Ajax generated one for everyone.

I would rather keep the Google dedicated version branch separate from the common version as I don't maintain it as much, especially in terms of CSS and navigation, which do not matter that much.

Is there a way to figure out that it is Google crawling the website and serve a static version instead?

Was it helpful?

Solution

The solution is to add the meta tag:

<meta name="fragment" content="!">

More details there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top