How To Eliminate Duplicate Content in WordPress Up To 99%SEO Tutorials | December 4th, 2007 | 8 Comments
As I previously wrote on why you should eliminate duplicate content and what are the benefits to have as less as possible duplicate content within your site (and especially in blogs that use WordPress as blogging platform) to give more weight to inner pages, today I am going to write this tip for bloggers how to eliminate duplicate content in wordpress. To make the changes is required that you have minimal HTML and PHP knowledge and understanding.
Thanks to the user friendly platform which WordPress has, modifying and tweaking it becomes easier. What it requires is just small modifications in your wordpress theme homepage in the php loop code that calls the posts and applying a small fix for duplicate content hack code for wordpress.
To make this tutorial easier for me to use I will use snapshots of code instead of writing the whole code (the important parts I will write them for easier copy), so lets see how the standard loop call code would look in your themes index.php file.
If you notice the line 8 is highlighted, that is the loop that “calls” and “displays” the post and thats how the PHP code will look out of the box as you install wordpress (as far as it regards the html markup that depends from theme to theme). Lets say we haven’t modified the theme at all, and we are using it out of the box as the designer of the theme uploaded it for free download. We have set up the number of the posts we want to be displayed in the homepage of our blog for the Options > Reading to 5 posts, at the moment we write the sixth post you will notice in your blogs homepage a new menu appearing, it could be “Older Posts” “Previous Posts” or a numerical menu as I am using at the bottom of the homepage. This secondary page of the homepage, with a loop like the one above in the image will display a full post as well, just as in the homepage, so even if the post is out from the homepage and you might be thinking that you have resolved the problem of the duplicate content for your post but you are wrong, as the post will be than visible in the “secondary page of the homepage”, using the wordpress duplicate content hack we resolve this problem immediately as we will create an “excerpt” of our post in the secondary pages instead of a full post. So lets see how would the loop code look like if we’d implement this hack.
(Had to stretch the image, otherways it was going to break the layout)
If you can notice (in the stretched image) the select code from line 6 down to line 15, that is how your loop code would look after adding the duplicate content fix for wordpress. The code will display full posts (or excerpts, depends how you have made the settings to display posts in homepage) in the first page of your blog while in the “secondary pages of the homepage” it will display an excerpt of 300 characters (note, on line 12 you will notice 0, 300); changing 300 to 400 or 500 will change the number of characters you want the excerpt to show).
In the archives (and categories) file (usually called archive.php) if the loop code looks like this <?php the_content() ?> which should be displaying the full content of the post, change it into <?php the_excerpt() ?>. By making this change in the archives and categories page you will be displaying ONLY the excerpt of the post, so another duplicate content eliminated from within our blog. But there is still one small problem left.
Using excerpts code it will write excerpt of the first 300 or 400 characters of our blog post, so we still have a part of our content as duplicate (even tho it is simply a teaser). Lets take a snapshot and see how it looks.
This is how is link exchange dead posts excerpt looks like in the homepage. Did you notice something over there? In case you didn’t, lets take another screen shot of the posts page.
Now do you notice? The first 400 characters of the content are the same as the one used in the homepage excerpt. Not that eliminating this will make a big difference (but who can really tell), but why I would not want that to be displayed in the homepage is because how I want to start a post would be totally different from what I would want the teaser to look like in the homepage (if I’d have to write a teaser).
Can we change how the teaser should look like? Sure thing (thank you WordPress). In the write page when you are writing the post, if you’d scroll a little you will find a box called Optional Excerpt. Writing a optional excerpt in that box will be displaying as excerpt if you’d use the hacks mentioned above, you can use the excerpt as teaser and keyword rich important for the homepage of your site.
By implement these hacks and spending just a little more time to write an Optional Excerpt for your title you will be eliminate by 99% the duplicate content WITHIN your site. Whoever wants to start doing SEO for his/her own website the first thing that he/she should be looking at is its own site. The roots of search engine optimization of a website start from within the site, the title, the heading tags, the internal linking, the duplicate content. Adjusting and optimizing all the above mentioned on page optimization factors will make sure you are prepared for the off site optimization which includes mainly, link building.
Hope this blogging tip makes sense to you and it will become of a good use for you, in any case, subscribe to my RSS feed if you want to read me daily.