art_meta_description
Overview
Providing the “description” meta tag is widely known as a good SEO practice. On top of that, it helps differentiate site’s pages, which prevents search engines from seeing them as duplicated content. It becomes then especially useful in a very special case of blogs. This plugin generates such a meta tag basing on the first words of the article, ending the quotation with horizontal ellipsis (…).
Usage
The plugin provides the <txp:art_meta_description /> tag that should be placed in the <head> of the page.
The plugin is designed to work on articles (where adding the “description” meta tag is virtually useful). Thus, there is no use of placing it on the pages that do not show single articles. However, the plugin won’t do any harm in that case – it will simply output nothing.
A few options are available to allow user to customise the plugin.
words- determines how many words are used to generate the tag. The default value is 25.
maxchars- determines the maximum number of characters (including the ellipsis) in the content of the generated tag. It is important because of search engines limits (too long descriptions could be banned). If the text that consist denoted number of words is too long, it is being automatically shortened to fit in allowed number of characters. The default value is 250.
prefercontent- allows to use the content of the article body instead of the excerpt, which is the default behaviour. Nevertheless, if the article excerpt turns out to be empty, the article body will be used, so there is no need to use this option if the excerpt is not present. The defalut value is
false
Example usage
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<txp:art_meta_description words="20" maxchars="150" prefercontent="true" />
<!-- the rest of the head goes here -->
</head>
The above example shows heavily customised usage of the tag. The plugin will take first 20 words of the article body (but not more than 150 characters).
End notes
The plugin is designed with Unicode support in mind, but it was tested only with Polish texts. All reports concerning other languages, as well as bugs and feature requests are very welcome.
Archived [?]: orphaned: broken links









Comments/questions? Leave a message in the form.
Commented (2)
Another way to get a page dependant meta-description with standard tags is shown here:
Trick: Textpattern with page dependent header meta description
http://performancing.com/node/2725
The main advantage is the fully customizable support for the content. I am using article title, article keywords plus some short pre-defined words.
Related is the article with the flashy but very true title: Header titles optimize AdSense output
http://performancing.com/node/3279
It’s ouputing broken html from the body in my descriptions
Subscribe to this article's comments RSS feed. [ ? ] View Recent Comments across the site.