Google showing dynamic page title set by JavaScript rather than the static title embedded in the HTML












3















On my website the title is initially set through the title tag in the html served by my server. It is then changed to its dynamic equivalent through JavaScript.



I want Google to show my website's title as the static one in the HTML, but for some reason, Google is listing the title set by JavaScript.



This issue has plagued me for a long time and I'm still without a solution.










share|improve this question





























    3















    On my website the title is initially set through the title tag in the html served by my server. It is then changed to its dynamic equivalent through JavaScript.



    I want Google to show my website's title as the static one in the HTML, but for some reason, Google is listing the title set by JavaScript.



    This issue has plagued me for a long time and I'm still without a solution.










    share|improve this question



























      3












      3








      3








      On my website the title is initially set through the title tag in the html served by my server. It is then changed to its dynamic equivalent through JavaScript.



      I want Google to show my website's title as the static one in the HTML, but for some reason, Google is listing the title set by JavaScript.



      This issue has plagued me for a long time and I'm still without a solution.










      share|improve this question
















      On my website the title is initially set through the title tag in the html served by my server. It is then changed to its dynamic equivalent through JavaScript.



      I want Google to show my website's title as the static one in the HTML, but for some reason, Google is listing the title set by JavaScript.



      This issue has plagued me for a long time and I'm still without a solution.







      seo html javascript title






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 6 '18 at 2:10









      Stephen Ostermiller

      67.3k1392248




      67.3k1392248










      asked Dec 5 '18 at 22:24









      WillBDevWillBDev

      161




      161






















          4 Answers
          4






          active

          oldest

          votes


















          1














          The only solution that will not hurt your SEO is to prevent your JavaScript from changing the page title for that particular page (perhaps with an if statement as Warren mentioned).



          A good rule of thumb (and the rules for many search engines including Google) is to always show the search engine the exact same thing you show the user. If you don't want it indexed in the search engine that way, simply don't show it to the user that way.






          share|improve this answer































            1














            It sounds like all you need is a simple JavaScript if-type statement added to your code to keep it from changing the title on whatever page.






            share|improve this answer

































              1















              pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date.




              I would ask yourself whether you need to change the page <title> (using client-side JavaScript) to specifically match the "dynamic" content, or just keep the generic catch-all title? What benefit does it give your users by changing the page title? If a user was to bookmark your page, the "dynamic" title will be bookmarked. If this is based on the date and the page content always contains content relating to the current date, then the bookmarked page title is going to become stale.



              If you do change the <title> then consider changing the URL as well (using JavaScript pushState) so the two match. Although your comment ("...pages are example.com/day/date") perhaps suggests this is already the case?






              share|improve this answer































                0














                What you are doing is a form of cloaking. It is against Google's Webmaster guidelines to show users one text and the search engine a different text. You need to set your titles such that the same title is seen by both users and Googlebot. If you show Googlebot different content, Google is likely to penalize your entire site such that it doesn't show up in the search results.



                The reason that Google is picking up the dynamic title is that Googlebot is now able to execute the JavaScript. The fix should be to use the same title for both users and bots.






                share|improve this answer
























                • Well basically my index page is example.com and the other pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date. When it's the regualar example.com url I want a normal title.

                  – WillBDev
                  Dec 6 '18 at 3:12











                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "45"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwebmasters.stackexchange.com%2fquestions%2f119457%2fgoogle-showing-dynamic-page-title-set-by-javascript-rather-than-the-static-title%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                1














                The only solution that will not hurt your SEO is to prevent your JavaScript from changing the page title for that particular page (perhaps with an if statement as Warren mentioned).



                A good rule of thumb (and the rules for many search engines including Google) is to always show the search engine the exact same thing you show the user. If you don't want it indexed in the search engine that way, simply don't show it to the user that way.






                share|improve this answer




























                  1














                  The only solution that will not hurt your SEO is to prevent your JavaScript from changing the page title for that particular page (perhaps with an if statement as Warren mentioned).



                  A good rule of thumb (and the rules for many search engines including Google) is to always show the search engine the exact same thing you show the user. If you don't want it indexed in the search engine that way, simply don't show it to the user that way.






                  share|improve this answer


























                    1












                    1








                    1







                    The only solution that will not hurt your SEO is to prevent your JavaScript from changing the page title for that particular page (perhaps with an if statement as Warren mentioned).



                    A good rule of thumb (and the rules for many search engines including Google) is to always show the search engine the exact same thing you show the user. If you don't want it indexed in the search engine that way, simply don't show it to the user that way.






                    share|improve this answer













                    The only solution that will not hurt your SEO is to prevent your JavaScript from changing the page title for that particular page (perhaps with an if statement as Warren mentioned).



                    A good rule of thumb (and the rules for many search engines including Google) is to always show the search engine the exact same thing you show the user. If you don't want it indexed in the search engine that way, simply don't show it to the user that way.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 6 '18 at 4:46









                    Maximillian LaumeisterMaximillian Laumeister

                    3,5151728




                    3,5151728

























                        1














                        It sounds like all you need is a simple JavaScript if-type statement added to your code to keep it from changing the title on whatever page.






                        share|improve this answer






























                          1














                          It sounds like all you need is a simple JavaScript if-type statement added to your code to keep it from changing the title on whatever page.






                          share|improve this answer




























                            1












                            1








                            1







                            It sounds like all you need is a simple JavaScript if-type statement added to your code to keep it from changing the title on whatever page.






                            share|improve this answer















                            It sounds like all you need is a simple JavaScript if-type statement added to your code to keep it from changing the title on whatever page.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Dec 6 '18 at 5:12

























                            answered Dec 6 '18 at 4:22









                            WarrenHWarrenH

                            112




                            112























                                1















                                pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date.




                                I would ask yourself whether you need to change the page <title> (using client-side JavaScript) to specifically match the "dynamic" content, or just keep the generic catch-all title? What benefit does it give your users by changing the page title? If a user was to bookmark your page, the "dynamic" title will be bookmarked. If this is based on the date and the page content always contains content relating to the current date, then the bookmarked page title is going to become stale.



                                If you do change the <title> then consider changing the URL as well (using JavaScript pushState) so the two match. Although your comment ("...pages are example.com/day/date") perhaps suggests this is already the case?






                                share|improve this answer




























                                  1















                                  pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date.




                                  I would ask yourself whether you need to change the page <title> (using client-side JavaScript) to specifically match the "dynamic" content, or just keep the generic catch-all title? What benefit does it give your users by changing the page title? If a user was to bookmark your page, the "dynamic" title will be bookmarked. If this is based on the date and the page content always contains content relating to the current date, then the bookmarked page title is going to become stale.



                                  If you do change the <title> then consider changing the URL as well (using JavaScript pushState) so the two match. Although your comment ("...pages are example.com/day/date") perhaps suggests this is already the case?






                                  share|improve this answer


























                                    1












                                    1








                                    1








                                    pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date.




                                    I would ask yourself whether you need to change the page <title> (using client-side JavaScript) to specifically match the "dynamic" content, or just keep the generic catch-all title? What benefit does it give your users by changing the page title? If a user was to bookmark your page, the "dynamic" title will be bookmarked. If this is based on the date and the page content always contains content relating to the current date, then the bookmarked page title is going to become stale.



                                    If you do change the <title> then consider changing the URL as well (using JavaScript pushState) so the two match. Although your comment ("...pages are example.com/day/date") perhaps suggests this is already the case?






                                    share|improve this answer














                                    pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date.




                                    I would ask yourself whether you need to change the page <title> (using client-side JavaScript) to specifically match the "dynamic" content, or just keep the generic catch-all title? What benefit does it give your users by changing the page title? If a user was to bookmark your page, the "dynamic" title will be bookmarked. If this is based on the date and the page content always contains content relating to the current date, then the bookmarked page title is going to become stale.



                                    If you do change the <title> then consider changing the URL as well (using JavaScript pushState) so the two match. Although your comment ("...pages are example.com/day/date") perhaps suggests this is already the case?







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Dec 13 '18 at 12:23









                                    MrWhiteMrWhite

                                    31k33365




                                    31k33365























                                        0














                                        What you are doing is a form of cloaking. It is against Google's Webmaster guidelines to show users one text and the search engine a different text. You need to set your titles such that the same title is seen by both users and Googlebot. If you show Googlebot different content, Google is likely to penalize your entire site such that it doesn't show up in the search results.



                                        The reason that Google is picking up the dynamic title is that Googlebot is now able to execute the JavaScript. The fix should be to use the same title for both users and bots.






                                        share|improve this answer
























                                        • Well basically my index page is example.com and the other pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date. When it's the regualar example.com url I want a normal title.

                                          – WillBDev
                                          Dec 6 '18 at 3:12
















                                        0














                                        What you are doing is a form of cloaking. It is against Google's Webmaster guidelines to show users one text and the search engine a different text. You need to set your titles such that the same title is seen by both users and Googlebot. If you show Googlebot different content, Google is likely to penalize your entire site such that it doesn't show up in the search results.



                                        The reason that Google is picking up the dynamic title is that Googlebot is now able to execute the JavaScript. The fix should be to use the same title for both users and bots.






                                        share|improve this answer
























                                        • Well basically my index page is example.com and the other pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date. When it's the regualar example.com url I want a normal title.

                                          – WillBDev
                                          Dec 6 '18 at 3:12














                                        0












                                        0








                                        0







                                        What you are doing is a form of cloaking. It is against Google's Webmaster guidelines to show users one text and the search engine a different text. You need to set your titles such that the same title is seen by both users and Googlebot. If you show Googlebot different content, Google is likely to penalize your entire site such that it doesn't show up in the search results.



                                        The reason that Google is picking up the dynamic title is that Googlebot is now able to execute the JavaScript. The fix should be to use the same title for both users and bots.






                                        share|improve this answer













                                        What you are doing is a form of cloaking. It is against Google's Webmaster guidelines to show users one text and the search engine a different text. You need to set your titles such that the same title is seen by both users and Googlebot. If you show Googlebot different content, Google is likely to penalize your entire site such that it doesn't show up in the search results.



                                        The reason that Google is picking up the dynamic title is that Googlebot is now able to execute the JavaScript. The fix should be to use the same title for both users and bots.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Dec 6 '18 at 2:14









                                        Stephen OstermillerStephen Ostermiller

                                        67.3k1392248




                                        67.3k1392248













                                        • Well basically my index page is example.com and the other pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date. When it's the regualar example.com url I want a normal title.

                                          – WillBDev
                                          Dec 6 '18 at 3:12



















                                        • Well basically my index page is example.com and the other pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date. When it's the regualar example.com url I want a normal title.

                                          – WillBDev
                                          Dec 6 '18 at 3:12

















                                        Well basically my index page is example.com and the other pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date. When it's the regualar example.com url I want a normal title.

                                        – WillBDev
                                        Dec 6 '18 at 3:12





                                        Well basically my index page is example.com and the other pages are example.com/day/date. They are all linked to the same base page but are changed dynamically relative to date. When it's the regualar example.com url I want a normal title.

                                        – WillBDev
                                        Dec 6 '18 at 3:12


















                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Webmasters Stack Exchange!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwebmasters.stackexchange.com%2fquestions%2f119457%2fgoogle-showing-dynamic-page-title-set-by-javascript-rather-than-the-static-title%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Probability when a professor distributes a quiz and homework assignment to a class of n students.

                                        Aardman Animations

                                        Are they similar matrix