When you write a post on WordPress a visitor can see this post on a variety of pages - the front page, the category page(s) that the post is under, the archive page, the author’s page, the tag page(s), plus, of course, the single post page. If you display the full post on each of those pages then there’s the potential for duplicate content issues. That aside it also doesn’t allow for easy navigation through your site to older posts.
Instead of thinking of your archive/category/tag/author pages as another version of your front page, think of them as the index to your site (I refer to index as a book index, as opposed to the index page, I know, confusing!). Instead of listing 5 or 10 posts on the category page, and then having to go back 5 pages just to get to a post you wrote a few months back, imagine opening one of these pages and having all of your posts listed, with the title linked to the post and the comment count after it.
Making your pages more available to the user is a great way to keep old posts in use. Deep linking from recent posts through to old posts should still be done, but if your users can see a list of all the posts in a category, or on a multi author site, simply click the author’s name and see all of the posts they’ve done, then you’re making the older pages more easily accessible. The great thing about this is that it’s not that hard to do either!
First off, don’t forget the Template Hierarchy. The file archive.php is the best file to use to then have a similar output for the pages already mentioned. You can go one step further and have individual files for each page, category.php, author.php etc. However don’t create the pages for the sake of having individual files. If they’re all going to use the same method and contain the same content (besides the post listings) then keep it to one file, it’ll make life easier in the future when you want to update the page!
Similar code to the front page is used, however we don’t need to print out the_excerpt() or the_content(). Instead we want to alter the tags within the loop to print out the post title as a list item with the comment count at the end (if you want it displaying). So taking the main loop code from the Classic theme, we originally have
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_date('','<h2>',''); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_tags(__('Tags: '), ', ', ' — '); ?> <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
<div class="storycontent">
<?php the_content(__('(more...)')); ?>
</div>
<div class="feedback">
<?php wp_link_pages(); ?>
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
</div>
</div>
<?php comments_template(); // Get wp-comments.php template ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
We only want a list item, the post title linked using the permalink tag, and the comment count displaying, so we can strip this down to
<?php
if (have_posts()) :
echo "<ul>\n";
while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
<?php comments_popup_link('', '(1)', '(%)'); ?></li>
<?php endwhile;
echo "</ul>\n";
else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
Here I’ve added in an opening UL tag between the if statement and the while loop, and then the matching closing tag is after the closing endwhile loop and before the else clause. Then the content posted within the loop is the list item that we want.
However, this requires one more piece of code to force WordPress to display all of the posts on one page, otherwise it will use the default number of posts set in your settings eg. 5 or 10 posts. The additional line of code you need to add before the if statement is
query_posts($query_string.'&posts_per_page=-1');
The query_posts() template tag allows you to alter or add to the query that controls what is retrieved and displayed from the database. All we need to do is to repeat the query string but add an additional parameter (posts_per_page) to specify how many posts to display on the page. By setting this to -1 we’re saying ‘display all posts’, ie. don’t set a limit.
You can also add in the date of the post too using the_time() template tag. Use the standard PHP date format to control the output of this.
So our final code looks like
<?php
query_posts($query_string.'&posts_per_page=-1');
if (have_posts()) :
echo "<ul>\n";
while (have_posts()) : the_post(); ?>
<li><?php the_time('d/m/Y') ?>: <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile;
echo "</ul>\n";
else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
Which would give an output such as
- 01/06/2008: Alternating Comment Styles
- 25/05/2008: Highlight Your Comments (26)
- 18/05/2008: Improve Your Front Page Title (2)
- 11/05/2008: Page Templates - Create a Links Page (9)
- 04/05/2008: List Your Recent Posts (12)
- 27/04/2008: Static Pages in WordPress (11)
- 20/04/2008: Template Tags, Categories and Tag Clouds (3)
- 13/04/2008: Understanding the WordPress Template Hierarchy (5)






















Ernesto | June 8th, 2008 at 1:08 pm #
This is really a problem among wordpress blog owners, the duplicate content issue brought about by the content being found on the blog’s various page. Does it really have negative effect on your bid to push your blog up the search engine rankings?
ebook cover creator | June 9th, 2008 at 2:25 am #
Yeah this problems has been bugging me for some time now. But its good to see you explain about it. Would help me to solve it in someways. Thanks for the explanation.
Sarah (Post Author) | June 9th, 2008 at 3:51 am #
Ernesto - I’m not an SEO so I’m not 100% sure how the effect of duplicate content on the same domain can have on rankings, I’ve not seen any major effects myself but I’ve not studied it that much. However the idea I’ve written about here is just useful anyway I think. I’d rather go to a category page and just see all of the posts in that category listed out so I can run through them all. A well written post title is all you need.
If you’re concerned over duplicate content on your site and you don’t want to list an index of your posts on your category and/or archive pages, then another idea would be to change your robots.txt file to not index any category or archive pages.
e.c.c. - you’re welcome
tourism | June 16th, 2008 at 1:27 pm #
I can suggest you most simple decision: just install WP all-in-one-seo plugin and check index checkboxes on the page types you don’t need to be indexed and that’s all!
enjoy
Save Youtube Videos | June 23rd, 2008 at 7:33 pm #
It definitely helps me to solve some of the problems faced in my blog

Thanks for explaining