Hacking WordPress and Controlling Duplicate Content
Update: I’ve since written how to achieve this without the need for a plugin at Blogging Tips and recommend you read that post once you’ve looked through the post below).
I often read about people’s concerns on having duplicate content on their website, especially bloggers as most blogs will have a full copy of a post on the front page (when it’s first published), the archives page for that month and the single post page. So potentially 3 pages with the same post on. Is this really bad? Personally I don’t think so. Afterall if Matt Cutts, a Google Engineer and in charge of issues such as this, runs a standard full post WordPress blog and doesn’t seem concerned then I don’t think anyone else should be! From what I’ve read in the past, the duplicate content issue is more an issue when it’s on multiple domains, not on the same site. Afterall plenty of sites have a ‘print this page’ button which displays the same content without the trimmings. The search engines can’t expect every developer to ensure that only one version of specific content is available to the bots. And if you’ve got more than one version on your site, so what? At most the search engine will determine which is the more important version and give that the most authority. Usually the single post page.
However… I appreciate people still want to change things so this is how I set my own category pages up to simply list every post in that category on just one page, and simply display the titles, grouped by year. For an example visit one of my category pages on the right there 😉
All Posts on One Page
First off, the easy bit. All the posts on one page. The reason I first started using this plugin was because the previous and next links don’t always work. I’ve recently discovered it’s a trailing forwardslash issue, but at the time I decided to just install a plugin that lists all the posts on one page. I came across the Custom Query String plugin (Update: this plugin no longer seems to be supported. However I’ve written how to achieve the same without the need for a plugin at Blogging Tips). This allows you to display more posts on your internal pages than your front page, which is essentially what I wanted. So a quick install later and you can set this to display all posts on either the category pages, archive pages or both. The plugin admin is pretty straightforward to use. So that deals with getting all the posts on one page.
Custom Category Page
Your theme may or may not already have a category.php page. If it does then that’s fine, but if not then first off duplicate the index.php file and name it category.php. By default WordPress will look for a category.php page (or archives.php for the Archives) and use that template page first. If none exists then it moves on to the index.php page. You now want to remove all the code between the
if (have_posts()) :
right near the bottom. All of this code is not needed for the category page. Replace this code with the following[source:php]