SEO affected Changing Title Tag by Javascript [duplicate]
Asked Answered
T

1

11

I am having a doubt regarding to this issue where let's say my page load is

<title>Test Only</title>

and I change the value by using javascript to

<title>Test Use JS Change</title>

// this is my Javascript code to update the <title> value after page load
$(function(){
    $('title').html('Test Use JS Change');
});

May I know for Search Engine Bot, will they recognize my title as Test Use JS Change or Test Only

It is because when I see the browser tab/ inspect element to view dynamic source, the title has been updated but when I purely view source only, it shows the default title that I defined.

Would need some advise regarding to this. Thanks!

Tereus answered 2/6, 2015 at 6:3 Comment(3)
Bots see the title you put into your source code, not the one which is generated by JS.Witt
@panther thank you for the reply, which mean it is pointless to change the metadata by using JS if I want the bot to crawl it.Tereus
When you change title depending on event on your site (eg. click), it helps to users but bots don't click (they fire no JS events like click, mouseover, etc.). Change title after the page is load with no other action make no sense.Witt
W
28

You can use JavaScript. Some bots, including Google, will execute the JavaScript for the benefit of SEO (showing the correct title in the SERP).

document.title = "Google will run this JS and show the title in the search results!";

Articles showing positive results: http://www.aukseo.co.uk/use-javascript-to-generate-seo-friendly-title-tags-1275/ http://www.ifinity.com.au/2012/10/04/Changing_a_Page_Title_with_Javascript_to_update_a_Google_SERP_Entry

Don't always assume a bot won't execute JavaScript. http://searchengineland.com/tested-googlebot-crawls-javascript-heres-learned-220157

Google and other search engines know that the best results to index are the results that the actual end user will see in their browser, including JavaScript.

Warplane answered 25/11, 2015 at 21:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.