Some Great SEO Tricks for WordPress: robots.txt and the Template Hierarchy
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
- 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:
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.