How to Minimize Duplicate Content in WordPress Blog

After reading this post at Google’s Webmaster Group, I was inspired to find out how to stop displaying full content on pages where posts were listed in categories, archives, etc. I am not so concerned about duplicate content as much as I don’t like for people to find a result in a category page but they have to look around the page to find it, or the post got moved to another page in the category and thus can’t find what they were looking for.

I didn’t know how to go about doing it so I searched. This page, Showing full posts on homepage, but snippets elsewhere, was a good start.

In short, the key is to edit the theme’s archive.php:

Change:

<?php the_content(); ?>

to:

<?php the_excerpt() ?>

A while back, I had copied the archive.php from the Default theme for another purpose, because Ocadia didn’t have its own version of the file. I ended up not using the file for anything important so I didn’t modify it much. Once I edited it to show snippets, or excerpts, on category and archive pages I noticed that it didn’t look like the homepage listings. For consistency, I copied the code between the divs for <div class="post"> in the theme’s index.php. With that change, pages for categories and archives no longer showed the posts in their entirety.

However, posts that were listed on “previous pages”, such as the one linked to at the bottom of the home page, continued to be a source of duplicate content. In the ocadia index.php, the code for search page is written to show excerpts. What I did was add a condition so that pages showed excerpts, too, like this:

<?php if (is_search() || is_paged()) { ?>

<?php the_excerpt() ?>

Now, if you go to the deeper pages of the index, category, etc, it shows post excerpts.

I also read recommendations to do the same to the home page. When I made the change to the home page, I did not find it aesthetically pleasing. The excerpted posts on the home page of the blog made it look like a splog that had scraped the content–not a good first impression for visitors. This was a situation where user experience trumped search engine optimization.

I just made these changes tonight. Time will tell if this will help or not.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>