What is MetaX?
MetaX (Meta Tags Extended) is a simple meta tag generation Snippet for MODX Evolution and MODX Revolution. MetaX will simplify and automate your meta tag creation.
Requirements
- MODx Evolution 0.9.6 or later
- MODx Revolution 2.0.0 or later
- PHP5 or later
History
MetaX was created in 2010 for both MODX Evolution and MODX Revolution using the same codebase. Since then, the codebase for MetaX has been split to take better advantage of new features in MODX Revolution. All versions of MetaX have been released by it's creator, Sal Sodano (http://salscode.com), with other contributors along the way. The old documentation may still be useful if you can't find what you need here http://salscode.com/modx-extras/metax.
Download
MODX Revolution
The Revolution version can be downloaded from within the MODX Revolution manager via Package Management, or from the MODX Extras Repository, here: http://modx.com/extras/package/metax
MODX Evolution
The Evolution version can be downloaded from the MODX Extras Repository, here: http://modx.com/extras/package/metax-evo
Usage
MODX Revolution
The MODX Revolution version, starting with MetaX v2.0, uses 3 stock chunks that determine the output with the ability to use your own custom chunk with the &tpl property. These chunks use a mix of MODX standard placeholders and MetaX computed ones. The MetaX specific placeholders are explained below.
The MetaX snippet can be called in MODX Revolution using the following syntax:
[[!MetaX]]
Properties
| Name | Description | Default |
|---|---|---|
| tpl | The name of the chunk to use for the output. This property overrides the &html property. | metax-xhtml4 |
| html | If 2, HTML5 syntax will be used. If 1, HTML4 syntax will be used. If 0, xHTML4 syntax will be used. | 0 |
| favicon | Path to favicon (checks to make sure the file exists). | favicon.ico |
| mobile | Path to mobile thumbnail (checks to make sure the file exists). | mobile.png |
| copyfrom | Year the copyright started/starts (i.e. 2003) | None |
| copytill | Year the copyright ended/ends. | Current Year |
| rss | Comma separated list of Document IDs that have RSS feed(s). | None |
| css | Comma separated list of CSS file URLs and also does IE conditional statements if needed (checks to make sure the file exists). | None |
Chunk Placeholders
| Name | Description |
|---|---|
| metax.robots | Outputs the appropriate robots command. |
| metax.canonical | Outputs the canonical url for the page. |
| metax.cache | Outputs the appropriate cache command. |
| metax.createdby | Outputs the full name of the resource's creator. |
| metax.editedby | Outputs the full name of the resource's last editor. |
| metax.copyyears | Outputs the copyright years dynamically based on the current year. |
| metax.favicon | Outputs the path to your favicon, after checking if the file exists. |
| metax.mobile | Outputs the path to your mobile icon, after checking if the file exists. |
| metax.css | Outputs the HTML needed for your CSS file(s), after checking if each one exists. |
| metax.rss | Outputs the HTML needed for your RSS feed(s), after checking if each resource exists. |
MODX Evolution
The MetaX snippet can be called in MODX Evolution using the following syntax:
[!MetaX!]
Properties
All of the above properties (except for &tpl) are also supported in the MODX Evolution version.
| Name | Description | Default |
|---|---|---|
| tabs | Controls the number of tabs in front of each element created. | 1 |
| spaces | Controls the number of spaces in front of each element created, spaces are added after tabs. | 0 |
| language | Controls the content in the content-language meta tag and in the Dublin Core language tag. | en |
| keywords | Name of the TV containing your keywords. | keywords |
| allkeywords | The name of the chunk that has keywords for use on all pages. | AllKeywords |
| abstract | Name of the Field/TV containing your abstract. | longtitle |
| author | Name of site author(s). | [(site_name)] |
| copyholder | Name of copyright holder. | [(site_name)] |
| ietool | If 1, disables the IE Image Toolbar by displaying the meta to disable it. If 0 does not display the meta (leaving the IE Toolbar enabled). | 1 |
The &css Property
The &css property of MetaX allows for IE conditional statements.
For example:
[[!MetaX? &css=`file1.css,file2.css:lte IE 7,file3.css:lt IE 7`]]
In the above example:
- file1 will be first and will have no IE conditional statements.
- file2 will be next and will have lte IE 7.
- file3 will be last and will have lt IE 7.
- This will output the following (note the actual output of the snippet is longer, this is only the part that the &css property controls):
<link rel="stylesheet" href="file1.css" type="text/css" /> <!--[if lte IE 7]> <link rel="stylesheet" href="file2.css" type="text/css" /> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" href="file3.css" type="text/css" /> <![endif]-->