August 13, 2011

Advanced Templates: Post Tags

Advanced Template Set designs are available with the Unlimited, Premium, and Business Class plans.

Container Tags

MTEntries: <MTEntries>
A container tag representing a list of the posts in your blog.

This is the primary tag to use whenever you want to display your blog posts, whether on your Main Index page, your DateBased or Category archives, or a listing on your sidebar. The MTEntries tag can take attributes that specify which posts to display and what order to display them in.

This will display the 10 most recent posts in the blog as a list of the post titles, each one linked to the post in the archives.

lastn
What: displays a specified number of the most recent posts, as long as the posts are within the last 30 days; otherwise, displays as many of the posts as are within 30 days
Usage: lastn="10"

offset
What: used with lastn, it starts the count by the offset amount, for instance to count ten posts starting ten posts back. Important: the offset tag does not work in conjunction with pagination and will prevent pagination from working properly.
Usage: offset="10"

days
What: displays posts from a specified number of the most recent days
Usage: days="10"

category
What: displays posts from a specified category, where Category is the name of the category
Usage: category="Category"

author
What: displays posts from a specified author, where username is the login name of the author
Usage: author="username"

sort_by
What: sorts posts for display by a field, where the options are title, status, modified_on, author_id, and excerpt. Does not work in combination with lastn
Usage: sort_by="title"

sort_order
What: sets the display order, where the options are ascend and descend. Does not work in combination with lastn
Usage: sort_order="ascend"

MTEntryIfExtended: <MTEntryIfExtended>
A container tag that will display its contents if the post has content in the post continuation field.

MTEntryIfAllowComments: <MTEntryIfAllowComments>
A container tag that will display its contents if the post has the allow comments option turned on, used to display information about the comments.
MTEntryIfAllowPings: <MTEntryIfAllowPings>
A container tag that will display its contents if the post has the accept trackbacks option turned on, used to display information about the trackback pings.
MTEntryNext: <MTEntryNext>
A container tag that changes the context to the next post, used on Individual archives to create navigation links.

MTEntryPrevious: <MTEntryPrevious>
A container tag similar to MTEntryNext, except that it changes the context to the previous post.

MTDateHeader: <MTDateHeader>
A container tag that will display its contents if the post marks a new day in the list of posts. This must be used within the MTEntries container

MTDateFooter: <MTDateFooter>
A container tag that will display its contents if the post is the last one in a given day in the list of posts. This must be used within the MTEntries container
MTEntriesHeader: <MTEntriesHeader>
A container tag that will display its contents if the post is the first one in the listing. This must be used within the MTEntries container
MTEntriesFooter: <MTEntriesFooter>
A container tag that will display its contents if the post is the last one in the listing. This must be used within the MTEntries container
MTWeblogPostIfShow: <MTWeblogPostIfShow>
A container tag that will display its contents if a specified field is set to be displayed, such as the post title. Takes attribute field which specifies the post field to check if it is set on Weblogs > Design > Change Content Selections to be displayed. This takes the values date_header and post_title.

MTEntryEnclosures: <MTEntryEnclosures>
Used in RSS 2.0 feed to list enclosures for each post; contains other tags.

MTWeblogIfExposeTags: <MTWeblogIfExposeTags>
A conditional container tag used to check if Technorati tags are enabled on a weblog; see below for other tags.
MTEntryIfTagged: <MTEntryIfTagged>
A conditional container tag used to check if Technorati tags are used in a post. See below for other tags.
MTEntryTags: <MTEntryTags>
A container tag used to display each Technorati tag in a post.

Variable Tags

MTEntryTrackbackData: <$MTEntryTrackbackData$>
adds invisible code to the post so that it can accept trackback pings.
MTEntryDate: <$MTEntryDate$>
the date the post was created, can be formatted with date and time tags.
MTEntryID: <$MTEntryID$>
the unique ID for the post.
MTEntryBody: <$MTEntryBody$>
the content of the post.
MTEntryPermalink: <$MTEntryPermalink$>
a permanent link to the post in your archives that people can use to link to it. Takes attribute archive_type to specify which set of archives to link to. This takes the values Monthly, Weekly, Daily, Category, Individual and combinations; e.g. Monthly|Daily|Weekly.
MTEntryCommentCount: <$MTEntryCommentCount$>
the number of comments on this post.
MTEntryTrackbackCount: <$MTEntryTrackbackCount$>
the number of trackback pings sent to the post.
MTEntryLink: <$MTEntryLink$>
similar to MTEntryPermalink.
MTEntryTitle: <$MTEntryTitle$>
the title of the post. Takes attribute generate which will generate a title from the first characters of the post if no title is set by the user. This takes the values 0 (no title generated) and 1 (titte generated).
MTEntryDateModified: <$MTEntryDateModified$>
if the post was edited after being created, the date it was last modified.
MTEntryExcerpt: <$MTEntryExcerpt$>
an excerpt of the post.
MTEntryAuthor: <$MTEntryAuthor$>
the author of the post.
MTEntryAtomContent: <$MTEntryAtomContent$>
the content of the post, in the format needed in an Atom feed.
MTEntryMore: <$MTEntryMore$>
the extended post or post continuation.
MTEntryTrackbackLink: <$MTEntryTrackbackLink$>
the trackback URL that people can use to ping the post.
MTEntryAuthorEmail: <$MTEntryAuthorEmail$>
the email address of the author of the post. Takes attribute spam_protect, which will encode the contents against spam harvesters. This takes the values 0 (no spam protection) and 1 (spam protection).
MTEntryAuthorURL: <$MTEntryAuthorURL$>
the web address for the author of the post.
MTEntryAuthorLink: <$MTEntryAuthorLink$>
the name of the author of the post, linked to their web address if available and otherwise to their email address. Takes attribute spam_protect, which will encode the contents against spam harvesters. This takes the values 0 (no spam protection) and 1 (spam protection)
MTEntryAuthorNickname: <$MTEntryAuthorNickname$>
the nickname of the author of the post, which is set on the author profile page.
MTEntryKeywords: <$MTEntryKeywords$>
keywords for the post.
MTEntryPermalinkRelative: <$MTEntryPermalinkRelative$>
similar to MTEntryPermalink but as a relative path rather than a URL.
MTEntryStatus: <$MTEntryStatus$>
the publication status of the post, Draft, Publish, or Future.
MTEntryPostFooter: <$MTEntryPostFooter$>
displays the blog Post Footer set in Weblogs > Design > Change Content Selections > blog Post Footer. To modify, replace with the following code, than make desired changes.

MTEntryAtomContent: <$MTEntryAtomContent$>
Used in Atom feed to display both the post body and the post continuation.
MTEntrySignInURL: <$MTEntrySignInURL$>
Used in Individual Archive template comments form to produce Typekey sign-in link.
MTEntrySignOutURL: <$MTEntrySignOutURL$>
Used in Individual Archive comments form to produce TypeKey sign-out link.
MTEntryEnclosureURL: <$MTEntryEnclosureURL$>
Used in RSS 2.0 template inside MTEntryEnclosures to produce URL of enclosed file.
MTEntryEnclosureMIMEType: <$MTEntryEnclosureMIMEType$>
Used in RSS 2.0 template inside MTEntryEnclosures to produce MIME type of file required for podcasting.
MTEntryEnclosureLength: <$MTEntryEnclosureLength$>
Used in RSS 2.0 template inside MTEntryEnclosures to produce file size of enclosure, required for podcasting.

MTTagLabel: <$MTTagLabel$>
A tag used to display a particular Technorati tag or label.

MTTagLabelClean: <$MTTagLabelClean encode_url="1"$>
A tag used to encode content in a Technorati tag.

Examples

Simple code to display posts on the main page of your weblog, and can be used on date-based and category archive pages as well:

The default code to display a listing of the ten most recent posts in a sidebar:

Search


Need design help?

Looking to launch a new blog? Have an itch to tweak your design or layout? Want a superior banner or design custom made specifically for your blog? We've got you covered!

Discover Typepad Services