WordPress: The Art of Avoiding Duplicate Content
We all know ‘Content Is King’. However, whoever said that, meant to say: ‘Unique Content Is King’. Putting together a beautiful website/blog is just the first step to your ebusiness. The more important part is to put together ‘unique content’ and avoid the duplication by following simple steps. This article is for those bloggers/webmasters who wish to avoid getting penalized for duplicate content, by Search Engines. After reading this article, you will master the art of avoiding duplicate content in your self-hosted WordPress Blog and this will help you in getting higher rankings on search engines by following simple easy techniques.
Lately, I researched on avoiding duplicate content and found some very interesting facts about avoiding duplicate content in WordPress, by changing few easy codes. I found that using excerpts is by far one of the best practices to avoid duplicate content.
To get into depth and understand what are excerpts, you should read the WordPress codex: Excerpt and understand what are excerpts and how they can be helpful. In layman language, WordPress Excerpts are summary of the actual posts which gives the user an idea about ‘what is being discussed in an article’. In-detail knowledge of the function the_excerpt can be found at WordPress Codex: Template Tags/the excerpt.
To effectively use excerpts in WordPress, you need to optimize the code of Index Page (index.php), Archives Page (archives.php), Category Page and Search Results page. The idea is to stay focused to the Single Post (single.php). Which means, the complete post or article should be visible only on the Single Post page. All other pages should show only the excerpt/summary of the article(s).
I’m using the Amazing Grace theme designed by Vladimir Prelovac, so I will take it as an example and describe how to use the_excerpt() function and avoid content duplication. However, by understanding the actual code, you can apply this on any given WordPress theme. If you look at the actual Index Page (index.php) of the Amazing Grace theme, you will see this code (Please note, in the original theme, the excerpts have been configured for only Archive Pages and Search Results Pages) in the source:
<div class="entrybody">
<?php if (is_archive() || is_search()) : ?>
<?php the_excerpt(); _e('<p><a href="'.get_permalink().'">
Continue reading about '); the_title(); _e('</a></p>'); ?>
<?php else : ?>
<?php the_content('Read the rest of this entry ยป'); ?>
<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
<?php endif; ?>
</div>
In the above code, you can see, the excerpts have been configured for only Archive Page and Search Results Page. However, we want to have complete posts only for Single Post pages and all the other pages should show just the excerpt/summary. So, I configured the code as follows:
<div class="entrybody">
<?php if (is_singular()) : ?>
<?php the_content(); ?>
<?php else : ?>
<?php the_excerpt(); _e('<p><a href="'.get_permalink().'">
Continue reading about '); the_title(); _e('</a></p>'); ?>
<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
<?php endif; ?>
</div>
You can compare the two codes mentioned above and understand that in the new code, We have used the_content() for ONLY Singular Posts (The actual Post Pages). And we have used the_excerpt() for all other pages. Doing this will ensure that the complete post appears only on the actual Post Pages and no where else. To describe the code a bit more, I’m including some further information:
<div class="entrybody"> //Starting of code.
<?php if (is_singular()) : ?> //Starting of 'if statement.
<?php the_content(); ?> //Show complete content.
<?php else : ?> //The 'else' statement.
<?php the_excerpt(); _e('<p><a href="'.get_permalink().'">
Continue reading about '); the_title(); _e('</a></p>'); ?> //Show excerpt.
<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?> //Show tags of post.
<?php endif; ?> //Ending of code.
</div>
Since, Amazing Grace and Blue Grace (Both designed by Vladimir Prelovac) have been wonderfully coded, it is easy to tweak the code to avoid content duplication, however, similar tweaks can be done on any given theme and master the art of providing unique content to Search Engines.
If you are using a different theme, please feel free to ask me questions. I will be glad to tweak the code for you. If you have any better tips to resolve the ‘wordpress duplicate content’ issue, please feel free to post a comment below. You can explore other wordpress tutorials that may interest you or help you in one way or the other.
Thankyou for reading this article!
Tags: Wordpress Tutorials




Thank you so much for posting about avoiding duplicate content. I am new to using WordPress and have very limited knowledge of editing php code. I love the Amazing Grace theme you referred to but thought I was going to have to change themes. I just couldn’t figure out what part of the php code I needed to change regarding excerpt. Your examples shown above and explanation was very helpful to correcting the problem I was having.
Great job and thanks again for such a detailed explanation. Now, I’ll know how to correct this with any WordPress theme I decide to work with.
I’m glad to know that the article was helpful. Thanks for the kind words
Your comment is full of motivation, I will share more experiences in the upcoming posts.
Regards.
I have an iphone 3G, and I have lots songs in my iphone, because it is synced with my computer(iTunes), what if I bought a new computer, how do you keep your old songs in your iphone? Or shall I say would you be able to sync your iphone with a new computer without losing any old songs? Many thanks!