Search Google and/or this blog

Sunday, March 15, 2009

Set Blog/Article Title as Page Title

Stumble del.icio.us Reddit MyWeb! Facebook Google bookmark

To save yourself some effort and to enhance the search engine ranking (:D), one should help create the page titles in such a way that it is most relevant to what the blog/article talks about. This means you should have a way or have control over how the page title is displayed when you open up a new article or new blog on a blogsite. On a blog like blogger.com, it's easy to do. Here is how you can achieve this :
[YOU ARE ADVISED TO "DOWNLOAD FULL TEMPLATE" BEFORE YOU MESS WITH ANYTHING.]

  1. Go to Dashboard -> Layout ->Edit HTML
  2. Locate the <head> just around the top portion in the textbox.
  3. Just a few lines below <head> , replace <title><data:blog.pagetitle/></title> with the following:


  4. <b:if cond='data:blog.pageType == "item"'>
    <title>
    <data:blog.pageName/> | <data:blog.title/>
    </title>
    <b:else/>
    <title><data:blog.pageTitle/></title>
    </b:if>


  5. Hit save and you are done!!!
  6. Now, if you are interested in how it's done Here you go.
  7. The code above simply says that if the pagetype is an article, meaning someone has opened a page to view one full article, then the title should be page name (article title in case of blogger) separated by a pipe character and then blog title (your blog name) otherwise, the title should just be your page title (which by default will be your blog title).

0 comments:

Post a Comment

Leave your opinion here. Or let me know if you face a problem ...I'll try to get back to you as soon as I can.