Content last modified Tuesday 24 August 2021
hop to #bottom
Categories:
Author:
Current version:
0.1
About It:
Get it:
Rate it:
  • Helpful?
  • 3 Yes
  • 7 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

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

You know you want to visit the Archives.
Published with Textpattern