Not a developer? Go to

Plugin and Theme Directory

Text Macros

By Byrne Reese
Posted October 5, 2010, in Developer.


This plugin provides a framework for developers to create really simple text macros that can processed inside of text. What is a macro? Well imagine you need a way of embedding within an entry some dynamic text, like the URL to page elsewhere on the site. Suppose you don't know the actual URL or the URL may actually change, but you do know the page's ID. So using this plugin you can embed the following text inside of an entry:

[% PageURL id="32" %]


To install this plugin follow the instructions found here:

Supported Macros

  • PageURL - takes a single argument id which identifies the page for which to generate a URL for.

Need another macro, but don't know how to build one yourself? At Endevver, we'll create one for you. And if it is simple, which it probably will be, we'll do it for free. We're that nice. Yes we are. Visit our help center to submit your request.

Enabling Macros

To turn on the text macro capabilities you need to add the following attribute to any template tag: text_macros="1".

You can easily encapsulate any text output by a template and enable macros for large blocks like so:

[% PageURL id="3" %]

Macro Syntax

Macros are bounded by an opening [% and a closing %]. They cannot encapsulate text. They are only tokens that will be substituted by a text value later.

Arguments not recognized by a macro will be ignored.


The following are all acceptable syntaxes for the same tag.

  • [% PageURL id="3" %]
  • [%PageURL id="3"%]
  • [%pageurl id="3" ignore_me="foo"%]

Known Issue

Macros that do not have a handler defined for them will have a blank string substituted in their place.

Developer Guide

Creating New Macros - Writing a Handler

Handlers for new macros are defined in a plugin's config.yaml under the text_macros key. Each macro specifies a handler for processing input. Each handler takes as input a single argument in the form of a hash containing the arguments passed into the tag.


In your plugin define the following in the registry:

id: MyPlugin
name: 'My Plugin'
  PageURL: $MyPlugin::MyPlugin::macro_page_url

Then create the following library file plugins/MyPlugin/lib/ and in it create the following subroutine:

sub macro_page_url {
  my ($args) = @_;
  my $page;
  if ($args->{'id'}) {
      $page = MT->model('page')->load( $args->{'id'} );
  } elsif ($args->{'basename'}) {
      $page = MT->model('page')->load({ basename => $args->{'basename'} });
  return $page->permalink;

Frequently Asked Questions

Does Text Macros work with any MT template tag and if so how is this different from mteval?

Text Macros is a distinct "language" from the more powerful templating language that powers Movable Type and Melody. The reason we developed these macros was in order to create a much simpler and more constrained way of injecting dynamically generated content into an entry. We could have used the MTEval plugin, but we ultimately felt that the MT templating language is too verbose, and for simple tasks, like embedding a URL to a page requires too much knowledge.

Help, Bugs and Feature Requests

If you are having problems installing or using the plugin, or if you would like to request us to implement a new macro to add to this pack, please check out our general knowledge base and help ticket system at


Perl Artistic




binasa on August 17, 2017, 6:32 p.m. Reply

Borrow up to 50,000 from the bookie so you can carry on racing (subject to 17. download torrent This Firefox extension boosts the capabilities of your mouse, particularly as you surf, but configuration may be overwhelming.


binasa on October 26, 2017, 10:36 a.m. Reply

Show off a little!) TEXT A SHOPPING LIST! Use the app for texting recipes too. Parents directly control what memories get added to a childs timeline and what information their friends and family can see.


Caroline11 on March 13, 2018, 10:49 a.m. Reply

Happy to come here.


Caroline11 on March 13, 2018, 10:51 a.m. Reply

Most relevant and good piece of content about updatenping you like to added here. I really enjoyed such content which help a lot to have unique approach. Infect, this article cause to solve my current assignment. I would like to say great thanks for this article. Any how, I need chief essays but here is the good information regarding different tools found here.

Vera Konrad

Vera Konrad on May 5, 2018, 2:59 p.m. Reply

Agent Orange. A world-class hybrid known for it’s potent orange aftertaste and extremely large, resinous buds. A very strong natural producer, Agent Orange is great for growers looking for a low-maintenance plant that will deliver. Agent Orange is a Hybrid marijuana strain with a distinct orange flavor. Agent Orange leaves you feeling energetic, and can help manage anxiety and stress.


ritariya on June 1, 2018, 12:22 p.m. Reply

It provides a framework for developers to create really simple text macros. You can add any attribute to the text macros. Macros are bounded by opening and closing. They are only the tokes that were substituted by the value. They specifies as a handler for processing unit.<a href="">in home care</a>

Leave a Comment

Byrne Reese

Byrne Reese was previously the Product Manager of Movable Type at Six Apart, where he had also held positions as the Manager of Platform Technology and Product Manager for TypePad. Byrne is a huge supporter of the Movable Type user and developer community. He dedicates much of his time to promoting and educating people about Movable Type as well as building the tools and plugins for Movable Type that are showcased on Majordojo. He contributes regularly to open source; and he is an advocate for open protocols and standards like Atom and OpenID.