Prepare for title tag using jQuery?

I want my title tag to look like this:

My Website - Name of Page

I want to add a part My Website -so as not to introduce it on every new page that I make. So the title tag that I actually have on the page will look like this:

<title>Name of Page</title>

Is it possible?

+3
source share
2 answers

I think for a jquery script this would be:

$(document).ready(function() { 
    document.title = "Your WebSite Name - " + document.title; 
}); 

I would recommend doing this at the page level rather than the client side though ...

+4
source

Others seem to have tried and failed to do this, use jQuery, but you can use document.title, http://hancic.info/change-page-title-with-jquery

0

Source: https://habr.com/ru/post/1741200/


All Articles