Arguably, one of the most important elements of a website from an SEO perspective is what comes between the <title></title> tags in the header of your page. Take a look at any search result page in Google and you’re probably looking at a list of websites with big blue links … and the text of those links is none other than the text Google found between the <title></title> tags when crawling the page.
So, this next post in our WordPress SEO series will cover how to control what gets displayed in that section of our site, and thus not only controlling what the Search Engines display as the title of our post/page in results pages, but also leveraging a powerful tool for ranking for those keywords we’re targeting.
While the complete order of tag importance is debated, one thing is for sure: the <title> and <h1> tags are definitely at the top in terms of importance for search rankings. Think about your tags as a means of communication with the search engines rather than display elements. What you put between the <title></title> tags is considered by the search engines to be THE MOST important information about the page it is viewing.
So, being able to control this is vitally important.
Structure
If you look at just about any WordPress theme worth its salt, you will find the title generating code in the header.php file, and it will look something like this:
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
As you can see, we are going to be doing some intermediate code hacking in this tutorial, so be prepared.
What you’re seeing are called “Template Tags” and they are what WordPress Themes use to display dynamic content that is being stored in the database. For a complete list of these template tags, view this Codex Page.
The template tags we’re interested in are wp_title(), bloginfo(‘name’), and bloginfo(‘description’). Respectively, they output the title of a single post or page and the name and tagline of your site (as defined in your Settings). Many themes have started optimizing this section automatically, and some have even gone as far as using many conditional tags to display specific information related to various archives (tag, category, date, etc.), but I have found it more than adequate to optimize for Single Posts, Pages, and your homepage.
The Default Theme
The default theme structures it’s <title> text like such:
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
Now, this format is actually bad for SEO, since the content it puts first is the title of your blog/website. Remember how results pages in Google show the content of the <title> for results? Well, if you want people to actually click on your page/post when viewing reults, then you need to give them the title of your post/page as soon as possible. The most irrelevant part of your titles is your blog’s name. So, move it to the end instead of the beginning.
Here’s a quick way of doing it:
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :: '; } ?><?php bloginfo('name'); if(is_home()) { echo ' :: '; bloginfo('description'); } ?></title>
In a nutshell, this code does the following — if viewing the homepage, it will display “Title of Blog :: Tagline of Blog” — and if viewing a single post or page it will display “Title of Post :: Title of Blog”. This puts your most important content first!
You Don’t Need a Plugin
I know that a lot of you out there are screaming at your screen for me to just recommend using a plugin like the All-In-One SEO Pack, which will handle this <title> optimization for you, and even give you more options than you can get by modifying your theme. That’s true, but please hear me out …
Yes, I do believe in using themes, not plugins, for outputting HTML that will be publically visible. But if you insist on using a plugin, then let me please encourage you NOT TO USE a certain feature of the All-In-One SEO Pack. That feature would be the “Custom Title” feature, which will allow you to use title text other than the text in your ACTUAL post/page title.
Some people find this advantageous because it allows you to “keyword stuff” their title, and game the system. But in my opinion, if this continues, the search engines will downgrade the value of the <title> and hurt everyone’s rankings.
So, as an alternative, if you want to use keywords in your <title>, then you need to use them in the ACTUAL title of the post or page. And using the method I outlined above will do that very thing. I’m certainly not discouraging you from using keywords in your Title, but if it can be avoided, for the sake of the future of your content, make the <title> and the Post/Page title exactly the same.
Tomorrow, we’ll be talking about header tags — when to use which tag (h1, h2, h3, etc.) for the most SEO benefit. Don’t miss it!