Mark on WordPress

WordPress puts food on my table.

WordPress Tip: Reorder your Title Tag

with 48 comments

WordPress, by default, creates <title> tags that look like this: <title>Yoursite » Your Post Title</title>.  Many people want to use <title>Your Post Title » Yoursite</title> instead, to give more importance to the mutable part of the <title>.  There are plugins to do this, but I’d like to show you how a simple change in your theme can accomplish this task. Caveat: this only works in WordPress 2.5 and above.

  1. Open your header.php theme file (if you don’t have one, open index.php or whatever one has your <title> tag)
  2. Look for:
    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
    (or something similar) 
  3. Replace it with:
    <title><?php wp_title('&raquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>

The first wp_title() argument is the separator character.  I like &raquo; (which looks like: »).  The second argument is whether to echo (print to the browser) the title, or to return it.  We want to print it, so we put true.  The final argument is where the separator should go… on the left or on the right. We want right, so we put "right". Simple enough!

Update: I got confirmation from Matt Cutts at Google that this is better for SEO.

Written by Mark Jaquith

April 23, 2008 at 12:26 pm

Posted in wordpress

Tagged with , , , ,

48 Responses

Subscribe to comments with RSS.

  1. It should be noted that the new ‘right’ optional parameter is new to WordPress 2.5, so you must be using it to do it this way.

    If you have an older version of WordPress, use the Optimal Title plugin instead.

    Otto

    April 23, 2008 at 12:55 pm

  2. will give it a shot
    thanks for the tip

    propaganda press

    April 23, 2008 at 1:32 pm

  3. Otto, thanks — updated the post to reflect that.

    Mark Jaquith

    April 23, 2008 at 1:33 pm

  4. good call Mark.

    I’ve been using the optimal title plugin for a while now to get the same effect as what you’re showing.

    it’s really helped in the search engine results, I feel.

    I actually have a file dedicated to my because of how many different variations I have for it.

    Jonathan Dingman

    April 23, 2008 at 1:56 pm

  5. Is there a way to do parenthesis like kottke.org?

    http://www.kottke.org/remainder/08/04/15507.html

    Trevor Turk

    April 23, 2008 at 2:24 pm

  6. Ahh. Thanks for the WordPress tip there! I’m curious to know if it is okay for SEO if I had used other special characters like ♥ in place of the right angle quote character that you had shown in the tip?

  7. Thanks for the EASY tip.
    usedbongs.com

    420bay

    April 23, 2008 at 4:39 pm

  8. Daniel, I can’t say for sure. I would guess that such characters would be ignored.

    Mark Jaquith

    April 23, 2008 at 5:18 pm

  9. I’ve been too lazy to switch this, but you gave me the nudge I needed. Thanks Mark! :)

    Bryan Villarin

    April 23, 2008 at 5:57 pm

  10. In addition to SEO, starting with the more specific title is also good for any situation where titles get put in a list — lists of articles, bookmarks, tabs, etc. — because it makes the important part easier to spot while skimming.

    Kelson

    April 23, 2008 at 6:13 pm

  11. [...] Gefunden bei Mark. [...]

  12. Lol. I tried using the heart. It looks weird on the title bar so I had it ignored and revert back to the angled quotes. Haha.

    Thanks for the tip guys!

  13. [...] Оригинал. 24 апреля 2008  |  комментарии RSS 2.0  |  trackback   |   Tags: tricks [...]

  14. Another SEO fix will be include a tag such that when there is no title, the blog name show up first, like on the home page or paginated pages, archives, search results etc. Code below.


    <title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' »'; } ?> <?php bloginfo('name'); //SEO FIX ?></title>

    hso

    April 24, 2008 at 12:53 am

  15. wow! nice.
    it’s good for SEO.

    Mus_

    April 24, 2008 at 1:01 am

  16. Hm, there IS a plugin that does that. It’s called SEO Title Tag.

    Cigar Inspector

    April 24, 2008 at 1:13 am

  17. Thanks for the tip! I appreciate it.

    matthelmke

    April 24, 2008 at 4:02 am

  18. I blogged about a method to do this on all pages with a title and display the blog name then the tagline on the home page, here http://www.unintentionallyblank.co.uk/2007/05/01/semantic-header-markup-means-search-engines-will-understand-too/

    Phil Nash

    April 24, 2008 at 4:31 am

  19. I use the all-in-one SEO plug in – I must admit that I’ve not looked into it too much to be honest, but I think I’ll optimise my titles at some point today, as they are one of the most important elements of SEO.

    Thanks for the tips :-)

    Carly

    April 24, 2008 at 4:33 am

  20. Carly, your right, titles are currently, and have always been, the most important tag,,, and I also use the same plugin. I have always taken out the name of the site and included the appropriate key words as needed. The title is the first thing viewers see in the search engines so I made that line as appealing as possible.

    Jack Kennard

    April 24, 2008 at 6:10 am

  21. Thank you very much for this tip. I changed header.php right away

    Daniel Condurachi

    April 24, 2008 at 8:02 am

  22. RE: Jack -

    I changed all my titles to post/page name | sitename | myname – as I already try and make the titles of the posts I want people to find Keyword rich, and I want my own name to feature higher in the SERPs.

    I shall have to wait and see if this works in the way I hope!

    Carly

    April 24, 2008 at 8:26 am

  23. Yah have been using Optimal Title plugin for all my blogs for a long time, glad to see it’s easier to do it natively in WP2.5.

    ShaolinTiger

    April 24, 2008 at 10:27 am

  24. And while you’re at it, you could also simply replace with your own blog name. It will reduce the amount of queries to the database by one for every pageview.

    Lodewijk

    April 24, 2008 at 10:49 am

  25. Personally I use ‘%post_title% presented by %blog_title%’ or ‘%post_title% on %blog_title%’ via the All In One SEO plugin for WordPress.

    This makes the title element a sentence that is easier to read and probably scores lots of points for accessibility. I read somewhere that page readers (for the blind) read the separators that so many of use have used in our title tags.

    For example this page’s title would be read out, “wordpress tip colon reorder your title tag left-pointing double angle quotation mark mark on wordpress.” How annoying is that?

    @Lodewijk : Top tip – I like that.

    yahoogle

    April 24, 2008 at 11:57 am

  26. I have changed the header.php file according to this tip and then realized that nothing has changed because I am already using the All in One SEO plugin.

    ;-(

    Chess Teaching

    April 24, 2008 at 12:16 pm

  27. wow…thank’s …
    it’s good for SEO.

    Alex L. Setiawan

    April 24, 2008 at 6:57 pm

  28. [...] webpages. Of course much of this discussion is about Search Engine Optimization (SEO). Having read Mark Jaquith’s WordPress tip on the subject I thought that I would add my own tip via the [...]

  29. wow… good tips;

    my tip is …

    what about this tip?

    sorry for my english…

    가우리

    April 25, 2008 at 9:50 am

  30. Nice tip. Thanks!

    Adam Presley

    April 25, 2008 at 2:35 pm

  31. [...] on WordPress mit dem Hinweis auf andere Anordnung der Template Tags Artikel #644, 27. April 2008 · Tipps, WordPress · 0 Kommentare Tags: SEO, [...]

  32. maybe a little bit problem with ” » ” and ” : ” while I need to save the html post :)

    dani

    April 29, 2008 at 9:22 am

  33. Did Matt Cutts say anything about the double arrows? Ages ago, there were issues with handling these in search indexes, but that seems to be resolved. Many visually impaired users complain about these and say they do not meet web standards. Personally, I’d love to see them gone and replaced with the traditional dash, so I’m never keen on recommending their use. I like things simple.

    Thanks for the info on the new parameters on the tag!

    Lorelle VanFossen

    April 29, 2008 at 8:19 pm

  34. Thanks for the tip.

    paulgray

    May 4, 2008 at 7:09 am

  35. [...] to Mark Jaquith, a WordPress lead developer, the default handling of title tags in WordPress is not optimal. And, [...]

  36. Hi!

    Can you give me tip how to create some block on sidebar only root page execept all others?
    Thanks!

    Odessky

    May 21, 2008 at 9:55 pm

  37. Hm, there IS a plugin that does that. It’s called SEO Title Tag

    toplist

    May 31, 2008 at 3:40 pm

  38. [...] First — The default WordPress theme shows the name of the blog before the title of the post. Reordering your title tag puts the text more relevant to the searcher’s query (the post title) first, encouraging [...]

  39. I have removed the blog/website name from my title as I think the fact that all pages have it is not ideal.

    What do you think? Is this a good idea?

    cheers
    Tony

    Tony Kenobi

    June 6, 2008 at 4:53 pm

  40. Cheers mate – I’ve managed to fix my title tags now (had no idea what I was doing TBH) but it’s now worked

    mercury thread

    June 13, 2008 at 5:35 am

  41. Thanks for the tip.

    isterimki

    August 9, 2008 at 8:38 am

  42. Excellent tip, Mark. Thanks!

    Eric

    September 11, 2008 at 5:17 pm

  43. For businnes blog i created | s

    in single.php

    Maybe, it is help for seo :D

    cerita

    September 22, 2008 at 2:31 pm

  44. [...] Mark on WordPress with Tip to reorder your title tag [...]

  45. mükemmel

    ligtv online

    November 5, 2008 at 11:53 am

  46. [...] Gracias [...]

  47. [...] WordPress Tip Reorder your Title Tag « Mark on WordPress [...]

    WordPress title help

    December 24, 2008 at 7:25 am

  48. I wanted to ask: what is the difference between yours:

    And this one I found on another site:

    |

    redsoxmaniac

    March 15, 2009 at 9:57 am


Leave a Reply