Tags are an essential part of nearly every WordPress blog. Webmasters use tags to categorize posts similarly to how they are categorized with categories.
One side-effect of tagging posts in WordPress is that these tags are sometimes indexed by search engines. Visitors from those search engines will then see a page containing excerpts of the posts that have been tagged with a specific tag.
This can result in two problems for the webmaster: Problem one is indexation. It can happen that a tag page gets indexed instead of the actual post.
There are plugins that can deal with the issue, and most add canonical information to articles so that search engines know that they are the main source and not the tag page.
The second problem is that the tag page can irritate search engine users as they only see excerpts and not a single article. This can look like spam to some, and might have a negative impact on a visitor's perception of the page and the website in general.
We have posted an option to create custom tag pages in WordPress back in April of last year and that method is still valid and working.
This method basically creates a new template file for each tag that the webmaster wants to customize. It can for instance be used to display an introduction to visitors so that they know what the page is about. This method allows the posting of media as well as text on the tag pages.
Posting those additional information can be beneficial to the search engine indexation of the tag page as well since it adds unique content to those pages.
The disadvantage of that method is that a new template file needs to be created for each tag that the webmaster wants to create a custom page for. This is impractical for websites with thousands of tags.
Another method was posted on the Likemind blog. This new method has been introduced in WordPress 2.8. It makes use of a new tag variable called description which can be added to the tag's template so that it will be displayed on the tag pages of the website.
Some WordPress themes come without a tag.php file. If that is the case it needs to be created and modified to include the description. The easiest way to do so is to copy the index.php file and rename the copy to tag.php. The following code needs to be added before the loop in tag.php
<?php $tag_desc = tag_description(); ?>
<?php if($tag_desc) : ?>
<?php print $tag_desc ;?>
<?php endif; ?>
Each tag page will from then on display the tag's description if available. Tag descriptions can be edited in the Posts > Post Tags menu in the WordPress admin interface.
The benefit of this approach is that only one template needs to be created and that everything else can be handled from within the WordPress admin area. That tag description can also be used as the meta description. There are some disadvantages though as it is difficulty to add formatting and media to the description (if at all possible).Advertisement
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.