Tags in the news post template
Where to edit: News → Post templates (the samples “Blog” and “Film page”; up to 20 versions are stored, each with a “Restore” button). A template is plain text with HTML markup into which tags in curly and square brackets are inserted.
Values ({…})
| Tag | What it outputs | Example |
|---|---|---|
{id} | the post number | {id} |
{title} | the title; the option limit=N truncates it | {title limit=60} |
{url} | the post address | <a href="{url}"> |
{site} | the site name | {site} |
{date} | the publication date; the option format= sets its look | {date format=d.m.Y} |
{author} | the author's name | {author} |
{category} | the category name | {category} |
{category.url} | the address of the category page | <a href="{category.url}"> |
{excerpt} | the short text; the option limit=N | {excerpt limit=160} |
{body} | the full text of the post | {body} |
{cover} | the cover; the option size=WxH | {cover size=600x400} |
{views} | the number of views | {views} |
{comments} | the number of comments | {comments} |
{readtime} | minutes to read | {readtime} |
{field:NAME} | the value of a custom field of the post; options limit=, size= | {field:director} |
{fieldlabel:NAME} | the label of the field | {fieldlabel:director} |
Tag options and defaults
| Option | Where it works | If not set | If set |
|---|---|---|---|
limit=N | title, excerpt, body and text fields | the text is not truncated | a number from 1 to 5000 (a smaller or larger value is clamped to the limit); truncates by characters with “…”; for body it outputs plain text without markup; a non-numeric value is ignored |
format=… | date | d.m.Y | only the characters d D j m M n Y y H i s a A g G h F, a space, ., /, :, - are allowed, up to 20; otherwise it is d.m.Y as well |
size=WxH | cover and a picture field | the picture has no width and height | for example 300x450, each side up to 4000; otherwise the option is ignored |
Correct usage: {cover size=400x300}, {date format=d.m.Y}, {excerpt limit=160}.
Inside a loop ([each:…]): {item} is the current item, {item.url} is its address (for tags and files), {item.alt} is the picture caption (for a gallery), {index} is the sequence number starting from one.
Post page tags
Neighbouring and related posts, printing, text pages, pictures by number, the author card, the poll and the report. All values go through an allowlist: text is escaped, and addresses are only a path from the root or https://.
| Tag | What it outputs | Example |
|---|---|---|
{previous.title} {previous.url} {previous.date} {previous.excerpt} {previous.cover_url} | the previous post (older); empty if there is none. The same for {next.…}, the next post | [if:next.url]<a href="{next.url}">{next.title} →</a>[/if] |
[each:related] … {item} {item.url} {item.excerpt} {item.date} {item.cover} | related posts (the ones set in the post) | [each:related]<li><a href="{item.url}">{item}</a></li>[/each] |
{print_button} | the “Print” button (works without theme scripts) | {print_button} |
{pages} {page.current} {page.total} {page.prev_url} {page.next_url} | a post split by [page] tags: the list of pages, the number, the count, the links; empty for a post without splitting | [if:page.total]{pages}[/if] |
{image:1.url} … {image:20.url}, [if:image:N], {images.count} | the pictures of the post text in order; empty if there is no such one | <img src="{image:1.url}" alt=""> |
{author.avatar_url} {author.bio} | the avatar and the “About me” of the author — only if the author's profile is open | [if:author.bio]<p>{author.bio}</p>[/if] |
{author.role} {author.role_name}, [if:author.role=editor] | the author's senior role: label and machine name; in a condition either of the two fits, and several can be given separated by commas | [if:author.role=editor,admin]Editors[/if] |
{author.posts} {author.rss_url} | how many posts the author has on the site; the author's feed | {author.posts} |
{poll} | the poll of the post (if one is chosen) | {poll} |
{report} | “Report this post” — an expandable form (comments and reports must be on) | {report} |
{comments.subscriptions_url} | the “My subscriptions” page (for a signed-in user) | <a href="{comments.subscriptions_url}">Subscriptions</a> |
{archive_day.url} | the news archive for the day the post came out | <a href="{archive_day.url}">More from this day</a> |
The category and the chain of sections of a post and a feed are visible to the main frame on tags: {category.*}, [each:crumbs] (news › parent category › category › post).
Conditions and loops
| Post | What it does |
|---|---|
[if:name]…[/if] | outputs the part if the value exists (is not empty) |
[ifnot:name]…[/ifnot] | outputs it if the value does not exist |
[if:name=value]…[else]…[/if] | compares with the value, otherwise outputs the second branch |
[each:tags]…[/each] | repeats over the tags of the post |
[each:field:NAME]…[/each] | repeats over a field with many values: multiple choice, gallery |
These names are available for conditions: title, excerpt, body, cover, author, category, views, comments, tags, field:NAME.
Comparisons: greater, less, not equal
You can add an operator to a condition: [if:year>2000], [if:price<=100], [if:genre!=drama], [ifnot:year>=2030]. The operators are =, !=, >, <, >=, <=. If both sides are numbers (a comma counts as a dot), numbers are compared, otherwise text is compared, ignoring case. An empty or missing value never passes a "greater/less" comparison.
List parameters: key=value
You can configure a list with parameters separated by spaces, after the name and before the closing bracket:
[each:news_list category=films,serials limit=5 sort=views field:year>2000]
<a href="{item.url}">{item.title}</a>
[/each]The familiar form news_list:cat:3:limit:5 works as before and means the same thing — use either one.
| Parameter | Value |
|---|---|
category (cat) | categories: a number or a name, a list 3,5, a range 3-7, an exclusion !news (it is subtracted from a range: 3-7,!5) |
not_category | the categories to exclude |
limit / start | how many posts (1–100) / which one to start from |
sort | the order: new, old, title, views, rating, rand |
days | for how many last days |
author (user), tag | the author and the tag, by number |
field:NAME | by an extra field: field:year>2000, field:genre!=drama, field:director=Kubrick |
home, fixed, cover, poll, password, comments, featured | flags; you can use yes/no, yes/no, 1/0 |
lang, cache | the language and how many seconds to keep the result (up to an hour, for guests only) |
The template editor highlights an unknown parameter with a warning that shows the line; a tag takes up to eight parameters. A value with spaces is written in quotes: title="two parts". Which parameters your particular list supports, see in the insert for that list.
Security and limits
| Rule | Value |
|---|---|
| PHP, function calls, reading files and settings | none — the language can only insert a value, check "is there one" and go through a list |
| Template HTML | cleaned against an allowlist: no script, style, form, iframe, no on* and data-* attributes |
Addresses in href/src | only http(s)://, a path from the root /… and #… |
| Template size | no more than 20000 characters |
| Number of tags | no more than 400 |
| Nesting of conditions and loops | no more than 6 levels |
| Repeats in a list | no more than 200 |
| Size of the result | no more than 300000 characters |
Values are escaped on the spot: differently in text, in an attribute and in an address, so a post title with a quote or a tag does not break the layout.
Updated 16.10.2026
No one has commented yet. Be the first.