So I’ve recently become aware of some of the SEO boo’s an out of the box wordpress install will inflict on your blog (actually I shouldn’t use inflict, because wordpress is great tool, but I’m using my poetic license :).
The key problems are duplicate content and sub optimal page titles. There are probably a plethora of other articles going in to great detail on this very subject and no doubt a good many plugins, but I just wanted to knock up a quite list so I could keep a note of the key steps and blindly apply them on other installations later on.
Improve Page Titles
We want the page title to be the title of the post, edit header.php and change the title tag as follows:
<title><?php if ( is_home() ) { bloginfo('name'); echo(' — '); bloginfo('description'); } else wp_title('',true); ?>%lt;/title>
Fix Duplicate Content
Insert the follow code in header.php after the title tag - this stops robots indexing the pages where your posts are duplicated:
<?php if((is_home() && ($paged > 2 )) || is_date() || is_category()) {
echo ‘<meta name=”robots” content=”noindex, follow, noarchive” />’;
} ?>
Improve Permalink Structure
Ultimately, we want to have the page urls for each post as http://www.blogname.com/seo-friendly-post-title/.
- Login
- Go to Options
- Then click on Permalinks
- Change the format to ‘Custom’ with the following format
/%postname%/
- Submit
You can also use post slugs to manually tweak the url. E.g. You might want to change:
http://www.blogname.com/really-long-and-diluted-post-title/
http://www.blogname.com/cool-title/
Simply edit the post slug when you are writing a post.
Redirect Canonical To Urls
Your site should be on www.blogname.com or blogname.com - not both.
If your hosting supports it (and is apache based), you can edit your .htaccess file to set up a redirect. Assuming you want www.blogname.com (rather than blogname.com) add the following lines to your .htaccess file in your wordpress dir:
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.blogname\.com [NC]
RewriteRule (.*) http://www.blogname.com/$1 [R=301,L]
NB If you aren’t using url rewriting yet, you should add the following line aswell to enable URL rewriting:
RewriteEngine On
Stop Robots indexing your feeds and other unwanted pages
You can tell the robots (search engine spiders) not to index certain pages, edit your robots.txt filre to include the following:
User-agent: *
Disallow: /wp-admin
Disallow: /wp-includes
Disallow: /wp-content/plugins
Disallow: /wp-content/cache
Disallow: /wp-content/themes
Disallow: /trackback
Disallow: /cgi-bin
Disallow: /search
Disallow: /feed
Disallow: /rss
Disallow: /comments/feed
Disallow: /feed/$
Disallow: /*/feed/$
Disallow: /*/feed/rss/$
Disallow: /*/trackback/$
NBIf your blog is in a subdirectory, prefix the above with the blog directory name, e.g.
/rss => /blog/rss
Install the blog in the top directory or on a subdomain
Optimally your blog is on it’s own domain, so www.blogname.com goes straight to your blog, and it’s not installed in a subdirectory like www.blogname.com/blog. When you install wordpress, be sure to move the extracted files out of the extracted directory and into the top directory of your site.
Alternatively set up a subdomain for your blog e.g. blog.mywebsite.com.
Helpful Plugins and Themes
The K2 extension TripleK theme is used by this site, and automatically applies some of the above fixes.
I’ll add some more ideas some!
Referneces