I love WordPress, it’s made web publishing and blogging incredibly easy and available for so many people.
But, Depending on your theme or setup, it’s also easy to make hundreds of pages of duplicate content within your own domain. For instance under the categories pages, by default your content is duplicated and paginated based on your posts_per_page setting. So some of your older posts can be incredibly difficult for users and search engines to get to.
My goal was to fix this using these two changes:
Read on for how I did it…
WordPress uses the first Template file it finds in your current Theme’s directory from the following list (assuming this is for category 6).
So, the easiest way to change the amount of posts per page shown for categories, is to do the following:
< ?php get_header(); ?>
< ?php get_header(); query_posts( 'posts_per_page=-1&cat=' . $cat ) ?>
This was also a simple quick change – I again edited my category.php file and looked for the following line:
< ?php if (have_posts()) : ?>
Deleted everything between that if statement and its endif and put in the following:
<h1 id="cat_h1">< ?php single_cat_title() ?></h1>
< ?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="< ?php _e('Permanent link to'); ?> < ?php the_title(); ?>">< ?php the_title(); ?></a></li>
< ?php endwhile; ?>
With these two easy changes, I now show all posts within my categories regardless of my options settings, and have removed the duplicate content from the category pages by making every category article a link.
If you aren’t already using it, I also recommend the Permalink Redirect WordPress Plugin to help keep your URL schema straight and to ensure that there is only one URL associated with each blog entry.
Let me know how this works out for you, hopefully you find these changes useful.