Some Great SEO Tricks for WordPress: robots.txt and the Template Hierarchy

by Teresa Valdez Klein on July 20, 2007

Michael Gray from Graywolf’s SEO Blog has a wonderfully helpful video up on YouTube that shows the search engine optimization downside of using WordPress and how to get around it.

According to Gray, one of the biggest issues with WP from an SEO standpoint is that it puts content in a lot of different places:

  • Main Index
  • Categories
  • Date Archives
  • Author Archives

Duplicate content is a major problem in SEO because it confuses Google. When Google is confused, it gives lower priority to your content. You want to keep nice little silos for all of your information.

Here are a couple of the things Gray recommends:

  • Put your posts only in the one category that is most appropriate. More categories = more places where your content can be discovered and cached by the Google bot.
  • Use the more feature to keep your post’s full content from appearing anywhere but on the permalinked page where the post resides.
  • If you must cross-categorize, use your robots.txt file to keep bots out of repetitive date & category areas of your site.

All this is well and good if you’re starting a blog today, but what if you’ve had a WordPress blog for a while and you’re just starting to realize the downsides so far as SEO is concerned? What if the thought of going back through four and a half years worth of blog posts and inserting the “more” tag in all of them makes your head want to explode?

Thankfully, WordPress has a wonderful thing called a template hierarchy, this will allow you to do just about everything Gray suggests.

First of all, log into your FTP backend and download the following files from /wp-content/themes/yourtheme:

  • index.php
  • category.php
  • date.php
  • author.php

Don’t worry if the last three don’t exist in your theme, if they aren’t there, it just means that WordPress looks to index.php to tell it how to display category, date-based and author pages.

Now, open your file(s) in your favorite text editor and find the spot in your index.php file that says the_content and replace it with the_excerpt. That should limit the amount of content appearing on your home page and on any other page that relies on index.php to tell it how to act. If you do have any category.php, date.php or author.php files in your theme, be sure to make the same change to them.

When you look at your home, category, date-based and author pages now, you should see short excerpts rather than full posts. This will ensure that search bots index your individual pages, rather than your category or date-based archives. Which is always better for SEO purposes.

{ 3 comments… read them below or add one }

1 Using the tag to get better SEO in wordpress : [Jason Preston] 07.29.07 at 1:05 pm

[...] reason is detailed here, on the Blog Business Summit blog, but essentially, clipping your posts on the main page will [...]

2 AskApache 08.10.07 at 1:24 pm

Nice article, if you want you can check out the updated WordPress robots.txt file

3 Desinerd 09.19.07 at 1:10 am

I am using some wordpress plugins which do the tag generations and sitemap generation … they look good to me … your article is a great pointer on further optimization

Sponsored links

advertise here