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.
- Open your
header.php
theme file (if you don’t have one, openindex.php
or whatever one has your <title> tag) - Look for:
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
(or something similar) - Replace it with:
<title><?php wp_title('»', true, 'right'); ?> <?php bloginfo('name'); ?></title>
The first wp_title()
argument is the separator character. I like »
(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.
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.
will give it a shot
thanks for the tip
Otto, thanks — updated the post to reflect that.
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.
Is there a way to do parenthesis like kottke.org?
http://www.kottke.org/remainder/08/04/15507.html
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?
Thanks for the EASY tip.
usedbongs.com
Daniel, I can’t say for sure. I would guess that such characters would be ignored.
I’ve been too lazy to switch this, but you gave me the nudge I needed. Thanks Mark! 🙂
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.
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!
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>
wow! nice.
it’s good for SEO.
Hm, there IS a plugin that does that. It’s called SEO Title Tag.
Thanks for the tip! I appreciate it.
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/
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, 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.
Thank you very much for this tip. I changed header.php right away
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!
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.
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.
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.
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.
;-(
wow…thank’s …
it’s good for SEO.
wow… good tips;
my tip is …
–
what about this tip?
sorry for my english…
Nice tip. Thanks!
maybe a little bit problem with ” » ” and ” : ” while I need to save the html post 🙂
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!
Thanks for the tip.
Hi!
Can you give me tip how to create some block on sidebar only root page execept all others?
Thanks!
Hm, there IS a plugin that does that. It’s called SEO Title Tag
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
Cheers mate – I’ve managed to fix my title tags now (had no idea what I was doing TBH) but it’s now worked
Thanks for the tip.
Excellent tip, Mark. Thanks!
For businnes blog i created | s
in single.php
Maybe, it is help for seo 😀
mükemmel
I wanted to ask: what is the difference between yours:
And this one I found on another site:
|
very nice for seo iuse this for my iklan baris gratis
Thanks. That works.
78. Good blog! I truly love how it is simple on my eyes and the data are well written. I am wondering how I could be notified when a new post has been made. I have subscribed to your RSS which must do the trick! Have a nice day!