How to Make Your Wordpress Installation Google Friendly
Advertisement
Wordpress, without any modification, is not exactly Google-friendly - especially if you're talking about duplicate content issues. To get the best search engine rankings, you'll need to make a few modifications. But don't worry, these only take about 10 minutes to put in place.
Dealing With Duplicate Pages
Did you notice how Wordpress organizes your content? It is complete with pages of recent posts, monthly archive pages, and category pages. These pages are full of the exact same content! (And Google hates duplicate content!)
So we want to avoid letting any search engines index those extra pages. To do that, we just have to paste a bit of code into the header.php file. Note that it has to go between the head tags. I've provided the code below:
<?php if((is_home() && ($paged < 2 )) || is_single() || is_page()){
echo '<meta name="robots" content="index,follow" />';
} else {
echo '<meta name="robots" content="noindex,follow" />';} ?>
To edit your template through the Wordpress admin panel, just click "Presentation" then "Theme Editor." Make sure your current theme is selected and click "Header.php" to edit that file. Now just copy and paste the code and click "Update File."
This code means that only your home page, Wordpress pages, and individual posts get indexed. Your archives and category pages, which are just duplicates, will not be indexed. However, all links will still be followed (a good thing.)
The Title Tag
You don't want the same title tag for each page. The ideal title tag will use the blog post title as the page title, and include the blog name if you wish. To accomplish this, replace your current Title tag with this:
<title><?php wp_title(' '); ?><?php if(wp_title(' ', false)) { echo ' - '; } ?><?php bloginfo('name'); ?></title>
The Meta Description Tag
Less important than the Title tag but still worthwhile is the Meta Description tag. It would be best for each page to have a unique description. And the easiest way to do that is by using the Head Meta Description Plugin.
301 Redirects via .htaccess
This is something you should be using on any website, but since Wordpress has tons of pages under various categories, it is very important. The code below needs to be placed in your .htaccess file. You don't need to understand it, you just need to paste it in there.
(But you do need to switch the "yourwebsite.com" to your actual domain name.)
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.yourwebsite\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourwebsite.com/$1 [R,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
The code will redirect any non-www pages to pages with the www, and it will add trailing slashes to all directories. (Trust me, it will help your search engine rankings.)
Disallow Useless Pages via Robots.txt
You'll want to keep the spiders from visiting all your useless pages, like the archives and your feed. This will help with duplicate content issues, and hopefully keep your site out of Google's supplemental results (you don't want to be stuck in there.)
User-agent: *
Disallow: /cgi-bin/
Disallow: /wp-
Disallow: /search
Disallow: /feed
Disallow: /comments/feed
Disallow: /feed/$
Disallow: /*/feed/$
Disallow: /*/feed/rss/$
Disallow: /*/trackback/$
Disallow: /*/*/feed/$
Disallow: /*/*/feed/rss/$
Disallow: /*/*/trackback/$
Disallow: /*/*/*/feed/$
Disallow: /*/*/*/feed/rss/$
Disallow: /*/*/*/trackback/$
Note: That code works if your blog is installed in the root directory. If your blog is at yoursite.com/blog/ you'll need a robots.txt file like this:
User-agent: *
Disallow: /cgi-bin/
Disallow: /blog/wp-
Disallow: /blog/search
Disallow: /blog/feed
Disallow: /blog/comments/feed
Disallow: /blog/feed/$
Disallow: /blog/*/feed/$
Disallow: /blog/*/feed/rss/$
Disallow: /blog/*/trackback/$
Disallow: /blog/*/*/feed/$
Disallow: /blog/*/*/feed/rss/$
Disallow: /blog/*/*/trackback/$
Disallow: /blog/*/*/*/feed/$
Disallow: /blog/*/*/*/feed/rss/$
Disallow: /blog/*/*/*/trackback/$
Again, don't worry what it means, just put it in your robots.txt file. It's good for you! (Check this out to learn more about robots.txt)
Use a Sitemap
While we're at it, let's talk sitemaps. Having one will help your blog get indexed fully, so it's worth doing. I'd recommend this cool Sitemap Generator plugin to help out.
That's it! Enjoy your improved Google rankings!
