Prevent duplicated content with WordPress – the hack

SEO Tutorials | May 15th, 2007 | 9 Comments

Since the last Google PageRank update my organic traffic (mainly from Google) has decreased in about 20% which has worried me a bit, i started a complete checkup on search engines for my blog. I ended up to find out that most of my posts were ending in Supplemental results, i got in panic..but then made peace of mind since i haven’t actually built many links for my blog for search engine optimization purpose and thought that my pages ended in supplemental results due to lack of quality backlinks to those pages.

There was no peace, after couple days i started thinking about this again, then i started to look around WordPress again and again, the exported HTML coding structure, the inner pages (even tho i am noob as far as it regards PHP programming language) i couldn’t see what was wrong. While surfing on my own blog i did notice something, i had duplicated pages all over my site *shocked*.

The same identical post could be found on the main page, on the archives page, on the categories page, on the secondary pages uh..thats just too much of duplicated content from just one web site. Since i am noob in PHP i started to look after a solution on Google, found thousends of ideas and tricks, suggestions to .htaccess block the pages where i would not want the bots to crawl so i can keep my post pages clean and safe from duplicated content, hacks for meta tags robots noindex control, those were all brilliant ideas, but wasn’t what i was exactly looking for, i did not wanted to block robots from crawling the category pages or the secondary pages, i just wanted to give more importance to the main page and the posts page to the search engines.

After hours and hours of searching, i got lucky, an ideal solution, a perfect SEO Optimization hack for WordPress, i found it. The hack for SEO optimizing the WordPress blog looks like this:

<?php if (is_home() && (!$paged || $paged == 1) || is_search()
|| is_single() || is_page()) {
the_content(‘Read the rest of this entry »’);
} else {
?>
<p>
<strong>Excerpt:</strong> <?= substr(strip_tags($post->post_content), 0, 300); ?>
<a href=”<?php the_permalink() ?>”>…</a>
</p>
<?php } ?>

An art work i would define it, it was exactly what i was looking for to best SEO optimize my WordPress blog. I replace the loop function of the WordPress themes index.php file (/home/usr/public_html/wp-content/themes/yourtheme/index.php) with that code.

What actually is this code doing is leaving the post as you have wrote it on the main page and on the posts page and rewrites the post into a Excerpt on the other pages (the archives page, category page, secondary pages). This way, search engines will give more relevance to the content on my main page and the posts page and less to the secondary pages, and i will also still be able to let the bots crawl the inner pages and even index them.

SEO Optimize your WordPress blog and prevent your posts pages ending in supplementary results because of duplicated content.

Spin Rewriter - Intelligent Content Spinning Software

9 Responses to “Prevent duplicated content with WordPress – the hack”
  1. sagbee says:

    so that code we should add on main “index.php” file somewhere around ? :confused:

  2. sagbee says:

    i hope i will get notification of your answer regarding about that topic ! geez you haven’t installed ….

  3. Hi Bee,
    Yes that could should be placed in the loop that calls the posts in the index.php

  4. […] This appears to be a good method to eliminating the duplicate content problem with WordPress blogs: http://www.dnseo.net/prevent-duplicated-results-with-wordpress-the-hack/ […]

  5. […] does hurt your web site in the search engine rankings, for this same purpose I wrote a post how to avoid duplicate content on wordpress with a wordpress hack that needs to be placed near the loop of the […]

  6. Balisugar says:

    I did put your code in my theme/index. php but always eror 🙁

  7. Hello Balisugar,
    What is the error you get?

  8. biz says:

    I do occasionally publish my articles on isnare and ezine articles? Should I stop doing this?

  9. @biz, similar question was asked by someone else on how to eliminate duplicate content article. The same answer is valid for you too. You should rewrite your article and publish the one you rewrote on the article directories instead of publishing the same article.

    Kind regards,
    Astrit