How To: Make Search Engines Like Your WordPress Blog

Wordpress LogoRecently, I discovered that this site had received a 100% SEO score from Domaintools. When comparing this rating to some larger sites, it seemed Sheeped beat them all by leaps and bounds.

What makes it even better, is that I’ve done relatively little to make my blog search engine-friendly, or “SEO-optimized”. Here’s what I did:

1. Modify page titles

By default, WordPress displays your blog’s name then your article’s name in the title. It should be the other way around. Not only is the article/page name first, blog name last good for SEO, humans like it too. Most of the WordPress themes out there use this approach, but if yours doesn’t or you’re using a vanilla WordPress, you can replace the <title></title> code in your theme’s header.php with this:

<title><?php wp_title(' '); ?><?php if(wp_title(' ', false)) { echo ' - '; } ?> <?php bloginfo('name'); ?><?php if (is_home()) { ?> - <?php bloginfo('description'); ?><?php } ?></title>

This will make your titles look like this site’s (check the title of this page).

2. Use Ultimate Tag Warrior and its meta keyword tag inclusion feature

Using Ultimate Tag Warrior to add specific tags to a post is pretty cool, but what’s even cooler is that you can enable inclusion of these tags as meta keyword tags in your pages. While humans do not directly benefit from this, search engines love it.

3. Use index and follow tags wisely

While it may seem nicer to have Google index everything at first, it’s usually not a good idea, especially on blogs. You don’t want search engines to index your whole site, especially if you’re not using excerpts for your archives. On a typical WordPress blog, there’s at least 4 different pages containing identical contents of a post (date/category/poster/tag/etc… archives). This can be penalized by search engines, but even if it isn’t, they might index the wrong thing. I’d hate to search for something and get a result linking to an article pasted in a blog archive for say, 2007.

This little snippet has helped me out a bunch. It also goes in header.php anywhere between the <head></head> tags:

<?php if(is_single() || is_page() || is_home()){
echo '<meta name="robots" content="index,follow" />';
} else {
echo '<meta name="robots" content="noindex,follow" />';
} ?>

All static pages, posts and the main page will be indexed. Archives and search results won’t. If you’re not using excerpts on your frontpage and are extremely obsessive with optimization and avoiding duplicate content, you may choose to remove the is_home() check. Just be aware that people searching for your site with e.g. “Sheeped” won’t find your front page, but rather some article on your site.

4. Use a robots.txt file to block out unwanted queries

You’ll want to place a robots.txt file at the root of your domain, listing paths and regex matches you do not want search engines to index. The robots.txt for sheeped.com looks like this:

User-agent: *
Disallow: /?
Disallow: */feed*
Disallow: */trackback
Disallow: */wp-admin
Disallow: */wp-content
Disallow: */wp-includes
Disallow: *wp-login.php

It disallows search engines from accessing my control panel (why should they?), my RSS feed (duplicate content!), search queries, and other pages search engines don’t need to index.

5. Enforce or remove trailing slashes from page queries

Similar to duplicate content, pages might be indexed twice with almost identical URLs, the only difference being the trailing slash. You can either enforce or remove trailing slashes from all page queries. Personally, I’ve chosen to enforce trailing slashes, and have touched the subject in my article, “How To: Remove ‘www.’ Permanently With .htaccess“. This can be easily done by modifying your .htaccess file. My .htaccess uses this rewrite rule to enforce trailing slashes:

RewriteEngine On
RewriteRule ^([^\.]+[^/])$ http://sheeped.com/$1/ [R=301,L]

6. Use Google Sitemaps

Having a search engine-readable sitemap in the root of your domain helps search engines index your pages quicker. As I mentioned in my article, “WordPress Plugins a Site Wouldn’t Function Without“, Arne Brachhold’s Google Sitemap Generator plugin for WordPress does everything for you. You just have to install it and enable it. That’s about as easy as it gets!

More to come…

Oh, and let’s not forget the cardinal rule of SEO optimization: The best SEO optimization is writing quality content.


Related Posts