Content last modified Monday 5 September 2016
hop to #bottom
Categories:
Author:
Current version:
0.1
About It:
Get it:
Rate it:
  • Helpful?
  • 3 Yes
  • 7 No
Flag it:
Contact Reason [ ? ]

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.

Article Request Count:

Archived [?]: orphaned: broken links

Initially released:
2006-08-19
Posted here:
19 Aug 2006
Article modified:
09 Apr 2008

Comments/questions? Leave a message in the form.

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (2)

Nice, someone did it finally.

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.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.