Jump to main content Jump to doc navigation

This page lists the most commonly used MODX Revolution tags as an aid to anyone converting HTML/CSS layouts into MODX Templates. These are frequently referred to as "tags" or "placeholders" (and sometimes "template variables"), so we mention those terms here as an aid to searching, although technically speaking they are not placeholders or template variables: they are MODX tags. Yes, it can be confusing for the newcomer, so just remember that there are different flavors of these tags, each with its own purpose and name. Placeholders are set in code and are displayed with placeholder tags. Template Variables are extra resource content fields created by the user. They can be thought of as custom fields. Neither placeholders, not template variables are pre-set by the MODX core.

Default Resource Content Field Tags

In MODX Revolution, each page will always have the following content fields that you can use when constructing your templates. Except for the Resource ID and the parent field, they are all supplied by the user when editing the resource and may be empty if the user did not fill them in:

Tag Description Example Usage
[[*id]] the Resource ID of the page (set by MODX when the page is created. Often used in conjunction with the link syntax, e.g. <a href="[[~[[*id]]]]">Bookmark this page!</a>
[[*pagetitle]] the Title of the page. <title>[[*pagetitle]]</title>
[[*longtitle]] the Long Title of the page <h1>[[*longtitle]]</h1>
[[*alias]] the page alias. Used to construct the URL of the page
[[*description]] the page Description <meta name="description" content="[[*description]]"/>
[[*introtext]] the Introductory Text field (a.k.a. the summary). Often used by Snippets to summarize posts, e.g. <div id="summary">[[*introtext]]</div>
[[*parent]] the ID of the parent page (if any). Set by MODX when the page is created. Can be altered by the user. Often used in conjunction with the link syntax, e.g. <a href="[[~[[*parent]]]]">Up to parent page</a>
[[*menutitle]] the Title used when the page appears in menus. Most frequently used by Snippets such as Wayfinder or pdoMenu when dynamically constructing menus
[[*content]] the content of the page. <body>[[*content]]</body>

Other Common Tags

These tags represent system settings, which are editable under the System menu -> System Settings.

Tag Description Example Usage
[[++site_url]] Contains the URL for your site, e.g. http://www.yoursite.com/ With many CMS's that rely on Apache rewrites, it's common practice to include a base tag in your HTML head: <base href="[[++site_url]]" />
[[++site_name]] Name of the site `[[++site_name]]</td> </tr> <tr> <td><strong><code>[[++site_start]]</code></strong></td> <td>Contains the ID of the page designated as your "home" page.</td> <td>Often used in conjunction with the link syntax, e.g. <code><a id="logo" href="[[~[[++site_start]]]]">Home</a></code></td> </tr> <tr> <td><strong><code>[[$chunk]]</code></strong></td> <td>This references a chunk by name. Chunks are any bit of reusable content.</td> <td>Common chunks might be for <em>header</em> or <em>footer</em></td> </tr> <tr> <td><strong><code>[[~link]]</code></strong></td> <td>Use this syntax to build links to pages by referencing their unique id (visible in parentheses next to the page's name in the resource tree). These links will not break if pages are moved or renamed. You can change the generated scheme of the link by passing the &scheme parameter (see <a href="/3.x/en/building-sites/settings/link_tag_scheme">link_tag_scheme</a>)</td> <td><code><a id="logo" href="[[~1]]">Home</a></code></td> </tr> <tr> <td><strong><code>[[%translated_message]]</code></strong></td> <td>Use lexicon tags to localize messages.</td> <td><code>[[!%setting_emailsender? &topic=`setting` &namespace=`core` &language=`en`]]</code></td> </tr> </tbody> </table> <h2>All Tags</h2> <p>As you increase your understanding of how MODX templates work, you'll want to have at your disposal the complete list of available content fields. Here is the complete list of all tags, gleaned from this <a href="https://forums.modx.com/index.php/topic,63481.0/topicseen.html" class="is-externallink" target="_blank" rel="noreferrer noopener">blog post</a>.</p> <table> <thead> <tr> <th>Tag</th> <th>Data Type</th> <th>Description</th> <th>Example Usage</th> </tr> </thead> <tbody> <tr> <td><strong><code>[[*alias]]</code></strong></td> <td>text</td> <td>Alias</td> <td>Normally, you will use the <em>id</em> to generate the URL, e.g. <code><a href="[[~[[*id]]]]">Click Here!</a></code>, but this lets you print out the alias parameter.</td> </tr> <tr> <td><strong><code>[[*cacheable]]</code></strong></td> <td>int 0/1</td> <td>Cacheable</td> <td></td> </tr> <tr> <td><strong><code>[[*class_key]]</code></strong></td> <td>int</td> <td>Class Key of the Resource, e.g. <em>modDocument</em></td> <td></td> </tr> <tr> <td><strong><code>[[*content]]</code></strong></td> <td>text</td> <td>Resource Content</td> <td></td> </tr> <tr> <td><strong><code>[[*content_type]]</code></strong></td> <td>int</td> <td>Content Type</td> <td></td> </tr> <tr> <td><strong><code>[[*createdon]]</code></strong></td> <td>date</td> <td>Created On date, e.g. <em>2011-04-14 20:40:50</em>, often used in conjunction with the <em>strtotime</em> output filter</td> <td><code>[[*createdon:strtotime:date=`%a %b %e, %Y`]]</code> See <a href="/3.x/en/building-sites/tag-syntax/date-formats">Date Formats</a>.</td> </tr> <tr> <td><strong><code>[[*createdby]]</code></strong></td> <td>int</td> <td>Created By User ID Number</td> <td></td> </tr> <tr> <td><strong><code>[[*deleted]]</code></strong></td> <td>int 0/1</td> <td>Deleted</td> <td></td> </tr> <tr> <td><strong><code>[[*deletedby]]</code></strong></td> <td>int</td> <td>Deleted By User ID Number</td> <td></td> </tr> <tr> <td><strong><code>[[*deletedon]]</code></strong></td> <td>date</td> <td>Date of Deletions</td> <td><code>[[*deletedon:strtotime:date=`%a %b %e, %Y`]]</code> See <a href="/3.x/en/building-sites/tag-syntax/date-formats">Date Formats</a>.</td> </tr> <tr> <td><strong><code>[[*description]]</code></strong></td> <td>text</td> <td>Description</td> <td></td> </tr> <tr> <td><strong><code>[[*editedon]]</code></strong></td> <td>date</td> <td>Edited On date, e.g. <em>2011-04-18 09:06:08</em></td> <td><code>[[*editedon:strtotime:date=`%a %b %e, %Y`]]</code> See <a href="/3.x/en/building-sites/tag-syntax/date-formats">Date Formats</a>.</td> </tr> <tr> <td><strong><code>[[*editedby]]</code></strong></td> <td>int</td> <td>Edited By User ID number</td> <td></td> </tr> <tr> <td><strong><code>[[*hidemenu]]</code></strong></td> <td>int 0/1</td> <td>Hide From Menus; this attribute is read by many Snippets, e.g. WayFinder</td> <td></td> </tr> <tr> <td><strong><code>[[*id]]</code></strong></td> <td>int</td> <td>Resource ID</td> <td>Used frequently to generate links to this page.</td> </tr> <tr> <td><strong><code>[[*introtext]]</code></strong></td> <td>text</td> <td>Summary</td> <td></td> </tr> <tr> <td><strong><code>[[*isfolder]]</code></strong></td> <td>int 0/1</td> <td>Container</td> <td></td> </tr> <tr> <td><strong><code>[[*link_attributes]]</code></strong></td> <td>text</td> <td>Link attributes; these are inserted automatically when you use the <code>[[~123]]</code> syntax</td> <td></td> </tr> <tr> <td><strong><code>[[*longtitle]]</code></strong></td> <td>text</td> <td>Long Title</td> <td></td> </tr> <tr> <td><strong><code>[[*menuindex]]</code></strong></td> <td>int</td> <td>Menu Index</td> <td></td> </tr> <tr> <td><strong><code>[[*menutitle]]</code></strong></td> <td>text</td> <td>Menu Title</td> <td></td> </tr> <tr> <td><strong><code>[[*pagetitle]]</code></strong></td> <td>text</td> <td>Page Title</td> <td></td> </tr> <tr> <td><strong><code>[[*parent]]</code></strong></td> <td>int</td> <td>Parent Resource</td> <td></td> </tr> <tr> <td><strong><code>[[*pub_date]]</code></strong></td> <td>date ---Publish Date</td> <td></td> <td></td> </tr> <tr> <td><strong><code>[[*published]]</code></strong></td> <td>int 0/1</td> <td>Published</td> <td></td> </tr> <tr> <td><strong><code>[[*publishedby]]</code></strong></td> <td>int</td> <td>Published By User ID Number</td> <td></td> </tr> <tr> <td><strong><code>[[*publishedon]]</code></strong></td> <td>date</td> <td>Published On</td> <td><code>[[*publishedon:strtotime:date=`%a %b %e, %Y`]]</code> See <a href="/3.x/en/building-sites/tag-syntax/date-formats">Date Formats</a>.</td> </tr> <tr> <td><strong><code>[[*richtext]]</code></strong></td> <td>int 0/1</td> <td>Rich Text</td> <td></td> </tr> <tr> <td><strong><code>[[*searchable]]</code></strong></td> <td>int 0/1</td> <td>Searchable</td> <td></td> </tr> <tr> <td><strong><code>[[*template]]</code></strong></td> <td>int</td> <td>Template ID number</td> <td></td> </tr> <tr> <td><strong><code>[[*unpub_date]]</code></strong></td> <td>date – Unpublish Date</td> <td><code>[[*unpub_date:strtotime:date=`%a %b %e, %Y`]]</code> See <a href="/3.x/en/building-sites/tag-syntax/date-formats">Date Formats</a>.</td> <td></td> </tr> <tr> <td><strong><code>[[*uri_override]]</code></strong></td> <td>int 0/1</td> <td>Freeze URI</td> <td></td> </tr> <tr> <td><strong><code>[[*uri]]</code></strong></td> <td>string</td> <td>URI</td> <td></td> </tr> </tbody> </table> <p>Just to clarify on <code>pub_date</code> – it's only set when the user sets a future date for publication in the Publish On field. And when the doc is actually published, it's zeroed out. The publishedon field always contains the most recent date that the resource changed from unpublished to published (or the date a new doc was saved with Publish checked).</p> <h2>See Also</h2> <ul> <li> <a href="/3.x/en/building-sites/tag-syntax/date-formats">Date Formats</a>: shows how to format date fields.</li> </ul> <ol> <li> <a href="/3.x/en/building-sites/resources">Resources</a> </li> <li> <a href="/3.x/en/building-sites/resources/content-types">Content Types</a> </li> <li> <a href="/3.x/en/building-sites/integrating-templates/named-anchor">Named Anchor</a> </li> <li> <a href="/3.x/en/building-sites/resources/static-resource">Static Resource</a> </li> <li> <a href="/3.x/en/building-sites/resources/symlink">Symlink</a> </li> <li> <a href="/3.x/en/building-sites/resources/symlink/using-resource-symlinks">Using Resource Symlinks</a> </li> <li> <a href="/3.x/en/building-sites/resources/weblink">Weblink</a> </li> <li> <a href="/3.x/en/building-sites/elements/templates">Templates</a> </li> <li> <a href="/3.x/en/building-sites/elements/chunks">Chunks</a> </li> <li> <a href="/3.x/en/building-sites/elements/snippets">Using Snippets</a> </li> </ol> </body>

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • Lefthandmedia
  • Murray Wood
  • eydolan
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$301 per month—let's make that $500!

Learn more