All tags are enclosed within less-than greater-than signs, just like HTML tags. You can optionally insert a
$ inside these signs, like this:
This can be useful to quickly determine whether a particular tag is an HTML tag or a Typepad tag.
$ is optional; a convention that is followed throughout the default templates and the documentation is to use the
$ on Variable Tags, but not on Container Tags.
Part of the reason for this is that you should not use the
$ on the end tag of a Container Tag, because the system will then be unable to find the end tag.
Certain tags are "container" tags; they contain what might be called a subtemplate, a chunk of text and tags between two other tags: the start of the container and the end of the container.
For example, if we have a tag called
<MTFoo>, you might see the following markup in one of your templates:
The start and end tags for a container look like standard HTML tags.
List Container Tags
If a container represents a list--the
<MTEntries> tag, for example--the subtemplate within the container will be applied to each of the items in that list.
For example, when you use an
<MTEntries> tag, the markup between
</MTEntries> is applied to each of the entries in the list.
Conditional Container Tags
If a container represents a conditional--the
<MTEntryIfExtended> tag, for example--the markup between the start and end tags will only be displayed if a certain condition is met.
For example, in the case of
<MTEntryIfExtended>, the condition tests whether the entry has an extended piece ("Post Continuation").
All non-container tags are simple variable substitution tags. They are placeholders for dynamic pieces of information. For example, the
<$MTEntryTitle$> tag is replaced with the title of the entry.
Some tags take attributes that modify their default behavior. Tag attributes work similarly to HTML tag attributes: they are lists of
name="value" pairs, separated by spaces. For example:
<MTEntries author="Foo" category="Bar">
(Look at the
<MTEntries> documentation to determine what this does.)
Attribute values must be enclosed in quotes; otherwise they will not be parsed correctly.
When using attributes in a tag where you are using the
$ character after the start and before the end tags, you should place the attributes before the end
$ character. For example:
<$MTEntryDate format="%B %e, %Y"$>
The attributes supported by the various tags are listed along with the tags.
The Importance of Context
Most tags are context-dependent, meaning that they should only be used in the appropriate context.
Context is generally determined by either the surrounding template or the surrounding container tags: for example, template markup is placed in entry context either within an
<MTEntries> tag, in an
Individual Entry archive page, in a
Comment Listing template, or in a
Comment Preview template.
Because of this, it only makes sense to use an
<$MTEntryTitle$> tag, or an
<MTComments> container, inside one of these contexts.