rah_metas

Published under current TXP projects

A tiny SEO- and meta-tool for Textpattern CMS. Build descriptions, simple meta info, rel links and prevent double content.

Download rah_metas v1.5

Image: rah_metas

Image: rah_metas

Intro and description

A Textpattern plugin used for SEO. The plugin includes basic SEO tools, from semi-automatic metainformation generation to useful redirections that prevent double content as rah_metas is also able redirect requested messy urls to cleans, leaving no space for the double content fault.

List of features

Requirements

Minimum requirements:

Recommended:

Installation and usage

The general behavior stands: paste plugin code to the plugin installer textarea and run the automatic setup. Then just activate the plugin and you are ready to use new tags that plugin includes like others.

For usage, basically just put <txp:rah_metas />-tag with wanted attributes to inside your site’s <head>-tags. As the plugin’s tag outputs metainformation, and meta-tags, it shouldn’t be used outside <head>-tags.

Attributes

The tag is <txp:rah_metas /> and attributes for it follow. Default value "" means that the attribute is unset and by default not used.

imagetoolbar
To block an browser’s image toolbar. Allowed attributes are true and false. By default not used.
Example: imagetoolbar="false" Default: ""

language
The language used by the site. Value should be a language code, for example en, de, it or se.
Example: language="en" Default: ""

robots
Directs how robots should navigate on the page. Valid values include index, noindex, follow, nofollow. The values can be combined.
Example: robots="index, follow" Default: ""

author
Author name that you want to show as the page’s author. Usually you, company or the website’s name. This value is used as the fallback when useauthor is used, but no author is available.
Example: author="John Doe" Default: ""

useauthor
If set to 1, <txp:author /> is used to populate author metadata when possible. The value set with author attribute will be used as a fallback in list context and such.
Example: useauthor="1" Default: "0"

copyright
Outputs copyright meta. Value is used as the content.
Example: copyright="Copyrihts &copy; 2007 John Doe" Default: ""

Description related attributes

description
A default meta description that will be shown in list context, or when there isn’t an article description to show and description_replacement is set on.
Example: description="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce at dui eget est congue aliquet. Quisque sed nunc" Default: ""

description_from
Which artile field is used for the automatic meta description. The attribute takes comma separated list of fields. The first field in the list that isn’t empty is used as the meta description. Available values: body, excerpt or custom field’s name. If set empty, the automatic description isn’t used.
Example: description_from="body,excerpt,metadescription" Default: "body,excerpt"

words
Limits the amount of words shown in the automatic meta description.
Example: words="15" Default: "25"

maxchars
The maximum number of characters used in the generated automatic meta description.
Example: maxchars="170" Default: "250"

description_trail
Ending trail used in the end of the automatic metadescription. Trail is only shown if the description is longer than the limit set by maxchars and/or words.
Example: description_trail="" Default: "&hellip;"

description_replacement
If set on (1) and there isn’t automatic description available, description attribute is used as the description instead. By default this feature is not used.
Example: description_replacement="1" Default: ""

escape
If set to 1, will remove raw Textile markup from the description. By default the attribute is unset, and the feature is not used. Usually this feature isn’t required, but it might be good if you are supplying the description in a custom field and you are using Textile there. Textile in custom fields isn’t, by default, parsed by Textpattern.
Example: escape="1" Default: ""

Keyword related attributes

keywords
Default keywords that will be used as keyword meta in a list context, or when there isn’t any keywords set for an article and keywords_replacement attribute is set on.
Example: keywords="life, Doe, cat, dog" Default: ""

keywords_from
Which field is used for the keyword meta. The attribute takes comma separated list of fields. The first field in the list that isn’t empty is used as the keywords. Available values, any article field: keywords, body, excerpt or custom field’s name. If empty, the feature isn’t used.
Example: keywords_from="keywords,excerpt" Default: "keywords"

keywords_replacement
If there isn’t keywords available for an article, use default defined in keywords attribute instead.
Example: keywords_replacement="1" Default: ""

keywords_limit
Limits the words used in the keywords. Takes a number.
Example: keywords_limit="5" Default: "25"

Redirect related attributes

messy_to_clean_redirect
Use messy to clean redirect. Redirects messy requrests to clean urls. Use this only if you use clean urls. With messy urls this only causes eternal loop.
Example: messy_to_clean_redirect="1" Default: ""

redirect_code
The code of redirection, value should be three numeric stannard status code protocol.
Example: redirect_code="302" Default: "301"

Rel link related attributes

relnext
Use rel link to point next page’s location to the browser. relnext attribute’s value is used as <link rel="next" /> tag’s title. Ideal values are Next, Go to next and so on. The attribute, relnext, adds a next rel link meta that points to the next section page or article by posting date. If attribute is used (filled) then used, if unset (empty) then not.
Example: relnext="Next" Default: ""

relprev
Use rel link to point previous page’s location to the browser. relprev attribute’s value is used as <link rel="prev" /> tag’s title. Ideal values are Previous, Go to prev and so on. The attribute, relprev, adds a next rel link meta that points to the previous section page or article by posting date. If attribute is used (filled) then used, if unset (empty) then not.
Example: relprev="Previous" Default: ""

prev_url
Manually defines relative prev url. Value should be a URL address. The URL is only used if automatic URL isn’t found.
Example: prev_url="http://www.example.com/path/to/id" Default: ""

next_url
Manually defines relative next url. Value should be a URL address. The URL is only used if automatic URL isn’t found.
Example: prev_url="http://www.example.com/path/to/id" Default: ""

Examples

#1: Basic usage

<txp:rah_metas keywords="dog, cat, house" description="Lorem lipsum" maxchars="170" words="15" />

#2: Using content preferring. First look at the custom field, then main article (excerpt, body) fields.

<txp:rah_metas description_from="MyCustomFieldName,excerpt,body" />

#3: Use rah_metas tag inside article_custom block

If rah_metas is placed directly inside article_custom (or article) tag, it can be used to pull the meta data from that specific article.

<txp:article_custom id="5">
	<txp:rah_metas />
</txp:article_custom>

In the code above, we took the meta data from the article where the ID is 5.

#4: How to not output description at all, but keep all other features intact?

<txp:rah_metas description="" description_from="" />

If description and description_from are set empty, no description will be generated. Same applies to keywords (see keywords and keywords_from attributes).

Changelog

Version 1.5

Version 1.4

Version 1.3

Version 1.2

Version 1.1

Version 1.0.5

Version 1.0.4

Version 1.0.3

Version 1.0.2

Version 1.0.1

Version 1.0

Version minor 0.9.2

Version minor 0.9.1

Version 0.9

Version 0.8

Version 0.7

Version 0.6

Version 0.5

Version 0.4

Version 0.3

Version 0.2

Version 0.1

Known issues

Redirects might not always work on old fast-cgi (requires clarifation), but on other systems fine.

Thanks to