3

I want to change some page elements with JS like title h1,h2,h3, p tags and so on.

So I want to place in my code something like

 $(function() {
     document.title = "This is the new page title."
});

So will it be SEO compatible? I have read some questions like this How to dynamically change a web page's title? and Can I randomly change the page title for users while showing search engines a static title? Some say that it will won't work, but some say that it will work because now google indexes js.

So will it be SEO compatible?

UPD: I want to change title for user and for google bots, for both of them.Just once on page load. There is always the same h1 for everybody, the changed title is the same for everybody.

Long story:

I need this because I am writing a js plugin. Something like cms but on our hosting. Client inputs there h1,h2,h3,h4 title and so on using recomendation of our seo improving program. He inserts at the end of page script, and script using some api get this values from our server and changes the page.

I know it is somekind of too much complicated. But if it works it will give more customers because customer is lazy and he doesn't won't to make changes in the website by himself sometimes websites don't have cms and he doesn't know html. So this script can be considered like external cms and in theory make customer's life simplier

  • 1
    Do you want your title to be changed "dynamically" on google serps or just for the user? Can you give us an example use case or rule which triggers the change? Like, are there different H1 headlines for users with a certain referral? – Milo Tischler Sep 2 '16 at 11:19
  • @MiloTischler I want to change title for user and for google bots, for both of them. – user2950593 Sep 2 '16 at 11:25
  • @MiloTischler see upd – user2950593 Sep 2 '16 at 11:34
  • @Evgeniy I didn't really get it. You say that when you fetch as google you don't see changes. But actually google bot indexes this changes? – user2950593 Sep 2 '16 at 11:41
1

I went to https://nerdydata.com and did a search for document.title = ". Then i searched for a result with a difference between title and document.title. I found: http://www.ipts.com/

enter image description here

So i checked Google with site:http://www.ipts.com/ and got the result:

enter image description here

.. so sometimes Google uses / tests other text on the website as title, but the JS document.title is the only location that exact string seems to appear:

enter image description here

Conclusion: It seems likely that you can set the title via JS. But don't forget, that Google tests other text on your website as title. Maybe even JS strings? With that in mind, i think: If the title "set with JS" is better for Google than the original <title> they will use it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.