N1 Nex1on

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 ({…})

TagWhat it outputsExample
{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

OptionWhere it worksIf not setIf set
limit=Ntitle, excerpt, body and text fieldsthe text is not truncateda 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=…dated.m.Yonly 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=WxHcover and a picture fieldthe picture has no width and heightfor 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://.

TagWhat it outputsExample
{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

PostWhat 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.

ParameterValue
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_categorythe categories to exclude
limit / starthow many posts (1–100) / which one to start from
sortthe order: new, old, title, views, rating, rand
daysfor how many last days
author (user), tagthe author and the tag, by number
field:NAMEby an extra field: field:year>2000, field:genre!=drama, field:director=Kubrick
home, fixed, cover, poll, password, comments, featuredflags; you can use yes/no, yes/no, 1/0
lang, cachethe 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

RuleValue
PHP, function calls, reading files and settingsnone — the language can only insert a value, check "is there one" and go through a list
Template HTMLcleaned against an allowlist: no script, style, form, iframe, no on* and data-* attributes
Addresses in href/srconly http(s)://, a path from the root /… and #…
Template sizeno more than 20000 characters
Number of tagsno more than 400
Nesting of conditions and loopsno more than 6 levels
Repeats in a listno more than 200
Size of the resultno 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

On this page
Share: Telegram WhatsApp
You can save things without signing in: they stay in this browser and you can move them to your account after signing in. Sign in
Discussion

Comments

No discussion yet

No one has commented yet. Be the first.

Report this post