Using tag_description() in WordPress To Create Unique Tag Pages

Something I’ve been testing on You’re Supposed To Be At Home is WordPress’  internal tag function. Tags are largely unused on blogs nowadays, and with good reason – tag pages create duplicate content. Often people just block them from search engines, but instead of blocking them, you can turn your tag pages into marvellous search engine friendly pages with rich content.

To do this, you need to make a few changes to your template. Open up tag.php and begin editing!

Switch Posts To Exerpts

Double check your site & see if there is a line that looks like the following:-


 <?php the_content(); ?>

Replace this with the following:-


 <?php the_excerpt(); ?>

Most templates do have the_excerpt() function, but double check it!

Add tag_description() above the Post Loop

Within the template, above the WordPress Loop, add the following:-


<?php 						if (tag_description() != "")

						{

						echo tag_description();

						} ?>

This will add on a paragraph or two onto the top of the post if there is anything located in the tag_description(). You add things via the “Post Tags” in WordPress’ Admin section.

Do I Have To Add A Tag Description for Every Tag?

No, only your most popular pages. They make great “sneeze pages”. Landing pages that get people looking at a selection of your posts. In the Tag Description, link to a range of your best posts related to that tag.

Thoughts?

Do you use tag descriptions? Say so in the comments!