Diary template tag reference

The tags and loops you can use in a diary template. If you are building or changing a design, use V2.

About the Different Template Versions (V1 and V2)

V2 is the better system for almost everyone: it is simpler to work with and it can do things V1 cannot. The only catch is that if you already have a V1 design you love, converting it takes some effort, and you do not have to, since V1 keeps working.

V1

The older system

V1 works fine and always will. A design is just split across several separate templates, so it is a bit harder to alter, and it does not get the newer features. If you already have a V1 design, there is no need to change it.

  • Content drops in through %%name%% tags.
  • Existing V1 designs keep working, untouched.

Whenever you change your template, the previous version is saved in History, so you can always go back to what you had before.

Values, loops, and conditions

These three forms cover most of what a V2 template needs. Output tags print a value, loops repeat markup, and conditions decide whether markup appears.

Print a value

Put a path inside double braces to print it safely.

<h1>{{ diary.title }}</h1>

Repeat a collection

A for block repeats its contents once for every item.

{% for tag in tags %}
    <a href="{{ tag.url }}">{{ tag.name }}</a>
{% endfor %}

Choose when to show something

An if block can test a value or compare it with a literal.

{% if page.type == 'archive' %}
    <h2>Archive</h2>
{% endif %}
V2

V2 complete reference

Use a path inside {{ and }} to print it. Collection names are used in for loops, and the item paths beneath them are available inside the loop.

Diary and page

Values that describe the diary itself or the page currently being rendered.

Tag or path What it provides
diary.username, diary.title The diary username, also used as the default diary title.
Example
{{ diary.username }} - {{ diary.title }}
Result Andrew - Andrew
diary.author_name The optional public author name from the diary owner's profile.
Example
{{ diary.author_name }}
Result Wren
diary.url The diary home URL.
Example
<a href="{{ diary.url }}">Home</a>
Result https://Andrew.dev.diaryland.com
diary.profile_url The public profile URL for the diary owner.
Example
<a href="{{ diary.profile_url }}">My profile</a>
Result https://dev.diaryland.com/u/andrew
diary.site_url The published member-site directory URL, or nothing when no site is published. (This only applies to the experimental member-site feature; ignore it if you are not using that.)
Example
<a href="{{ diary.site_url }}">My site</a>
diary.email_signup Your newsletter signup form, so readers can subscribe by email. Place it wherever you want the form to appear. Prints nothing without an active public newsletter.
Example
{{ diary.email_signup }}
Result (your newsletter signup form)
page.type The current page kind: latest, entry, or archive.
Example
{% if page.type == 'entry' %} ... {% endif %}
Result entry
page.is_page True when the current diary address is a page rather than a chronological diary entry.
Example
{% if page.is_page %} ... {% endif %}
Result true
page.archive_type On archive pages, whether this is the main diary archive or a tag archive: diary or tag. Empty on non-archive pages.
Example
{% if page.archive_type == 'tag' %} ... {% endif %}
Result tag
page.tag_name The current tag name on a tag archive page. Empty everywhere else.
Example
<h2>{{ page.tag_name }}</h2>
Result <h2>coffee</h2>
page.title The title of the current page.
Example
<title>{{ page.title }}</title>
Result <title>Rainy Tuesday</title>
page.url The canonical URL for the current page.
Example
<link rel="canonical" href="{{ page.url }}">
Result https://Andrew.dev.diaryland.com/rainy-tuesday

Entry values

Use these inside a loop over entries.

Tag or path What it provides
entry.title, entry.short_description The entry title or short description.
Example
<h2>{{ entry.title }}</h2>
Result <h2>Rainy Tuesday</h2>
entry.body The rendered entry body as safe HTML.
Example
<div class="body">{{ entry.body }}</div>
Result (the formatted entry text, as HTML)
entry.date, entry.time The entry date and time.
Example
<span>{{ entry.date }} at {{ entry.time }}</span>
Result 2026-07-23 at 10:30 pm
entry.url The full URL to the entry.
Example
<a href="{{ entry.url }}">Permalink</a>
Result https://Andrew.dev.diaryland.com/rainy-tuesday
entry.page_name The entry page-name segment used in its URL.
Example
<a id="{{ entry.page_name }}"></a>
Result rainy-tuesday
entry.is_page True when this entry belongs to a page rather than the chronological diary.
Example
{% if entry.is_page %} ... {% endif %}
Result false
entry.number The entry number.
Example
<a id="entry-{{ entry.number }}"></a>
Result 184
entry.option1 ... entry.option4 The four optional legacy entry fields.
Example
{{ entry.option1 }}
Result (whatever you saved in that optional field)
entry.comments_count, entry.has_comments The comment total and a true or false shortcut for whether comments exist.
Example
{% if entry.has_comments %}{{ entry.comments_count }} comments{% endif %}
Result 3 comments
entry.comments_html The complete styled comment list and comment form.
Example
{{ entry.comments_html }}
Result (the full comment list and form)
entry.comment_form The comment form without the existing comment list.
Example
{{ entry.comment_form }}
Result (just the comment form, no list)
entry.tags Tags attached to the current entry, in the order they were added. Each tag has the same fields as a diary tag.
Example
{% for tag in entry.tags %}<a href="{{ tag.url }}">{{ tag.name }}</a>{% endfor %}

Collections and their fields

Collections are lists you can loop through. The item name is your choice, although the examples use entry, link, buddy, tag, comment, and prompt.

Tag or path What it provides
entries Entries rendered on the current page. Tag archives contain their matching entries.
Example
{% for entry in entries %}<h2>{{ entry.title }}</h2>{% endfor %}
Result <h2>Rainy Tuesday</h2><h2>Sunday Coffee</h2>
recent, older, archive Recent is the newest configured slice, older continues after the current diary page, and archive holds the archive-page entries.
Example
{% for link in recent %}<a href="{{ link.url }}">{{ link.title }}</a>{% endfor %}
Result (a list of links to recent entries)
link.title, link.url, link.date, link.time, link.page_name, link.comments_count, link.has_comments Entry details and comment totals available on each item in recent, older, and archive.
Example
<a href="{{ link.url }}">{{ link.date }} - {{ link.title }} ({{ link.comments_count }})</a>
Result <a href="https://Andrew.dev.diaryland.com/rainy-tuesday">2026-07-23 - Rainy Tuesday (3)</a>
buddies The configured slice of the diary owner's fave diaries.
Example
{% for buddy in buddies %}<a href="{{ buddy.url }}">{{ buddy.username }}</a>{% endfor %}
Result (links to your fave diaries)
diary_pages Pages that stay outside the diary archive and chronological navigation.
Example
{% for diary_page in diary_pages %}<a href="{{ diary_page.url }}">{{ diary_page.title }}</a>{% endfor %}
Result (links to pages such as About or Contact)
diary_page.title, diary_page.url, diary_page.page_name The title, full URL, and page-name segment for one diary page.
Example
<a href="{{ diary_page.url }}">{{ diary_page.title }}</a>
Result <a href="https://Andrew.dev.diaryland.com/about.html">About</a>
buddy.username, buddy.url The username and diary URL for one fave diary.
Example
<a href="{{ buddy.url }}">{{ buddy.username }}</a>
Result <a href="https://sparrow.diaryland.com">sparrow</a>
buddy.is_more_link, buddy.remaining_count The final item can link to the complete public profile list. It is marked true and includes the number of hidden fave diaries.
Example
{% if buddy.is_more_link %}...{% endif %}
Result true, 40
tags Tags used by visible diary entries, ordered by use and then name.
Example
{% for tag in tags %}<a href="{{ tag.url }}">{{ tag.name }}</a>{% endfor %}
Result (links to each tag you have used)
tag.name, tag.url, tag.entry_count The tag name, its /tags/name archive URL, and the number of visible entries using it.
Example
<a href="{{ tag.url }}">{{ tag.name }} ({{ tag.entry_count }})</a>
Result <a href="https://Andrew.dev.diaryland.com/tags/coffee">coffee (12)</a>
entry.comments The comments attached to the current entry.
Example
{% for comment in entry.comments %}{{ comment.body }}{% endfor %}
Result (loops through each comment on the entry)
comment.author, comment.author_url, comment.url The display name, profile URL, and direct comment URL.
Example
<a href="{{ comment.author_url }}">{{ comment.author }}</a>
Result <a href="https://wren.diaryland.com">wren</a>
comment.body, comment.date, comment.relative_date The comment body and its absolute and relative dates.
Example
<p>{{ comment.body }}</p><span>{{ comment.relative_date }}</span>
Result <p>Loved this one.</p><span>2 days ago</span>
comment.username, comment.is_reply, comment.is_owner The author username plus true or false reply and owner flags.
Example
{% if comment.is_owner %}(author){% endif %}
Result username: wren, plus true or false flags
entry.prompts Daily prompt answers attached to the entry.
Example
{% for prompt in entry.prompts %}{{ prompt.label }}: {{ prompt.answer }}{% endfor %}
Result (loops through the daily prompt answers)
prompt.label, prompt.answer, prompt.date The prompt label, rendered answer, and prompt date.
Example
<strong>{{ prompt.label }}</strong> {{ prompt.answer }}
Result <strong>Mood</strong> Calm

Settings-aware list sections

Put the start marker before the section heading and the end marker after its final list reference. Settings enables the matching switch only when every reference is inside the marker pair.

Tag or path What it provides
<!-- diaryland-section:buddies:start --> ... <!-- diaryland-section:buddies:end --> Makes the buddy list heading and links controllable from Template lists in Settings.
Example
<!-- diaryland-section:buddies:start -->
<section>
    <h2>Fave diaries</h2>
    {% for buddy in buddies %}
        <a href="{{ buddy.url }}">{{ buddy.username }}</a>
    {% endfor %}
</section>
<!-- diaryland-section:buddies:end -->
<!-- diaryland-section:recent:start --> ... <!-- diaryland-section:recent:end --> Makes the recent entries heading and links controllable from Template lists in Settings.
Example
<!-- diaryland-section:recent:start -->
<section>
    <h2>Recent entries</h2>
    {% for link in recent %}
        <a href="{{ link.url }}">{{ link.title }}</a>
    {% endfor %}
</section>
<!-- diaryland-section:recent:end -->
<!-- diaryland-section:older:start --> ... <!-- diaryland-section:older:end --> Makes the older entries heading and links controllable from Template lists in Settings.
Example
<!-- diaryland-section:older:start -->
<section>
    <h2>Older entries</h2>
    {% for link in older %}
        <a href="{{ link.url }}">{{ link.title }}</a>
    {% endfor %}
</section>
<!-- diaryland-section:older:end -->
<!-- diaryland-section:tags:start --> ... <!-- diaryland-section:tags:end --> Use this pair around both the per-entry tags and the diary-wide tag list. One switch controls both areas, and it is enabled only when every tag reference is marked. In classic templates, these areas may be in the page and entryindivid editors.
Example
<!-- diaryland-section:tags:start -->
{% if entry.tags %}
<div class="entry-tags">
    {% for tag in entry.tags %}
        <a href="{{ tag.url }}">{{ tag.name }}</a>
    {% endfor %}
</div>
{% endif %}
<!-- diaryland-section:tags:end -->

<!-- diaryland-section:tags:start -->
{% if tags %}
<section>
    <h2>Tags</h2>
    {% for tag in tags %}
        <a href="{{ tag.url }}">{{ tag.name }}</a>
    {% endfor %}
</section>
{% endif %}
<!-- diaryland-section:tags:end -->

Navigation and pagination

Previous and next entry links are available on entry pages. Pagination is filled on numbered archive and flow pages.

Tag or path What it provides
nav.prev_url, nav.next_url URLs for the adjacent diary entries.
Example
<a href="{{ nav.prev_url }}">Previous</a> <a href="{{ nav.next_url }}">Next</a>
Result prev: .../monday-blues, next: .../wednesday-sun
nav.prev_title, nav.next_title Titles for the adjacent diary entries.
Example
<a href="{{ nav.prev_url }}">{{ nav.prev_title }}</a> <a href="{{ nav.next_url }}">{{ nav.next_title }}</a>
Result prev: Monday Blues, next: Wednesday Sun
nav.older_url The canonical /archive/ URL.
Example
<a href="{{ nav.older_url }}">Archive</a>
Result https://Andrew.dev.diaryland.com/archive/
pagination.page, pagination.total_pages The current archive page and total number of pages. Both are zero where pagination does not apply.
Example
Page {{ pagination.page }} of {{ pagination.total_pages }}
Result Page 2 of 9
pagination.per_page, pagination.total_entries The configured entries per page and total visible archive entries.
Example
{{ pagination.total_entries }} entries
Result 173 entries
pagination.prev_url, pagination.next_url The previous and next archive-page URLs, empty at either end.
Example
<a href="{{ pagination.next_url }}">Older</a>
Result https://Andrew.dev.diaryland.com/archive/3
pagination.pages A windowed list of numbered page links and gap markers.
Example
{% for p in pagination.pages %}<a href="{{ p.url }}">{{ p.number }}</a>{% endfor %}
Result (numbered page links)
p.number, p.url, p.is_current, p.is_gap The page number and URL plus true or false current-page and gap flags.
Example
{% if p.is_current %}<strong>{{ p.number }}</strong>{% else %}<a href="{{ p.url }}">{{ p.number }}</a>{% endif %}
Result 2

Language forms

V2 deliberately has a small language. It supports safe output, loops, conditions, comparisons, and loop position values.

Tag or path What it provides
{{ path.to.value }} Prints one value. Ordinary text is HTML-escaped.
Example
<h1>{{ diary.title }}</h1>
Result <h1>Andrew</h1>
{% for item in collection %} ... {% endfor %} Repeats the block once for each item in a collection.
Example
{% for tag in tags %}{{ tag.name }} {% endfor %}
Result coffee music books
{% if value %} ... {% else %} ... {% endif %} Shows one block when a condition is true, with an optional alternative.
Example
{% if entry.has_comments %}Comments{% else %}Be the first{% endif %}
Result Comments
not value, value == literal, value != literal Supported condition forms. Literals may be quoted text, bare words, integers, true, or false.
Example
{% if page.type != 'entry' %} ... {% endif %}
Result (shows when you are not on a single entry page)
loop.index, loop.index0, loop.length The one-based index, zero-based index, and item count inside a loop.
Example
{% for tag in tags %}{{ loop.index }}. {{ tag.name }} {% endfor %}
Result 1. coffee 2. music
loop.first, loop.last True on the first or last pass through a loop.
Example
{% for tag in tags %}{{ tag.name }}{% if not loop.last %}, {% endif %}{% endfor %}
Result coffee, music, books
V1 V1 reference

Classic tags are replaced with finished text or HTML. Some tags use a separate part template once for each entry, link, comment, or prompt answer.

Classic template parts

A V1 diary can use these saved pieces. Whole-page parts provide a document, while row parts repeat inside a list generated by another tag.

Tag or path What it provides
entryindivid Repeats once for each diary entry inserted by %%entries%%.
previousinclude Repeats for links inserted by %%recent_entries%% and %%older_entries%%.
older The complete classic older archive page.
olderindivid Repeats once for each entry link on the older archive page.
comments The complete legacy comments page used by old comments URLs.
commentsindivid Repeats once for each comment in a generated comment list.
daily_prompt_row Repeats once for each daily prompt answer inserted by %%prompts%%.

Main page and entry tags

These tags are available in the main classic template. Entry tags are also used by the individual-entry part.

Tag or path What it provides
%%username%% The diary username, also used as the default diary title.
%%author_name%%, %%authorName%% The optional public author name from the diary owner's profile.
%%entries%% The entries for this page, each rendered through the entryindivid part.
%%entry%% The current entry body, or all rendered entries when a page contains more than one.
%%entryTitle%%, %%entry_title%% The entry title or short description.
%%shortDescription%%, %%short_description%% The current entry title or short description.
%%date%%, %%time%% The entry date and time.
%%pageName%%, %%page_name%% The current entry page name.
%%entryNumber%%, %%entry_number%% The legacy entry number, with the current entry ID as a fallback.
%%postedby%% The legacy author option, with the diary username as a fallback.
%%option1%% ... %%option4%% The four optional legacy entry fields.
%%olderPage%%, %%older_page%% The classic older-page name assigned to the entry.
%%site_url%% The published member-site directory URL, or nothing when no site is published. (This only applies to the experimental member-site feature; ignore it if you are not using that.)
%%email_readers_signup%% Your newsletter signup form, so readers can subscribe by email. Place it wherever you want the form to appear. Prints nothing without an active public newsletter.
{% for tag in entry.tags %} ... {% endfor %} Tags attached to the current entry, in the order they were added. Each tag has the same fields as a diary tag.

Lists and tag loops

Most V1 lists arrive as finished HTML. Tags are the exception: classic templates can use the same focused tag loop as V2 when custom markup is useful.

Tag or path What it provides
%%recent_entries%%, %%recentEntries%%, %%recent%% The configured number of newest visible entry links.
%%older_entries%%, %%olderEntries%% The configured number of visible entries immediately older than the current diary page, using the previousinclude row part.
%%archive%%, %%archives%%, %%archive_entries%% The visible diary archive as entry links.
%%buddylist%% The configured slice of the diary owner's fave diaries.
%%pages%%, %%diary_pages%% A ready-made linked list of diary pages.
%%tags%% A ready-made linked list of tags used by visible entries.
{% for tag in tags %} ... {% endfor %} A focused loop supported in classic templates for writing custom tag markup.
{{ tag.name }}, {{ tag.url }}, {{ tag.entry_count }} The tag name, its /tags/name archive URL, and the number of visible entries using it.
{{ loop.index }}, {{ loop.index0 }}, {{ loop.length }} Position values supported inside the classic tag loop.

Settings-aware list sections

Put the start marker before the section heading and the end marker after its final list reference. Settings enables the matching switch only when every reference is inside the marker pair.

Tag or path What it provides
<!-- diaryland-section:buddies:start --> ... <!-- diaryland-section:buddies:end --> Makes the buddy list heading and links controllable from Template lists in Settings.
Example
<!-- diaryland-section:buddies:start -->
<section>
    <h2>Fave diaries</h2>
    %%buddylist%%
</section>
<!-- diaryland-section:buddies:end -->
<!-- diaryland-section:recent:start --> ... <!-- diaryland-section:recent:end --> Makes the recent entries heading and links controllable from Template lists in Settings.
Example
<!-- diaryland-section:recent:start -->
<section>
    <h2>Recent entries</h2>
    %%recent_entries%%
</section>
<!-- diaryland-section:recent:end -->
<!-- diaryland-section:older:start --> ... <!-- diaryland-section:older:end --> Makes the older entries heading and links controllable from Template lists in Settings.
Example
<!-- diaryland-section:older:start -->
<section>
    <h2>Older entries</h2>
    %%older_entries%%
</section>
<!-- diaryland-section:older:end -->
<!-- diaryland-section:tags:start --> ... <!-- diaryland-section:tags:end --> Use this pair around both the per-entry tags and the diary-wide tag list. One switch controls both areas, and it is enabled only when every tag reference is marked. In classic templates, these areas may be in the page and entryindivid editors.
Example
<!-- diaryland-section:tags:start -->
<section>
    <h2>Tags</h2>
    %%tags%%
</section>
<!-- diaryland-section:tags:end -->

<!-- diaryland-section:tags:start -->
{% for tag in entry.tags %}
    <a href="{{ tag.url }}">{{ tag.name }}</a>
{% endfor %}
<!-- diaryland-section:tags:end -->

Navigation and link-row parts

The previousinclude and olderindivid parts repeat once for each generated entry link.

Tag or path What it provides
%%prev%%, %%next%% URLs for the adjacent diary entries.
%%prev_desc%%, %%next_desc%% Titles for the adjacent diary entries.
{$d_page_name} The entry URL inside a repeating link-row part.
{$d_short_description} The entry title inside a repeating link-row part.
{$d_date}, {$d_time} The entry date and time inside a repeating link-row part.

Comments

The main entry template can insert the complete comment area. The individual-comment part controls one comment row.

Tag or path What it provides
%%commentscount%% The number of comments attached to the entry.
%%comments%%, %%commentsembed%%, %%comments_embed%% The complete styled comment list and comment form.
%%comments_list%% The existing comments without the form.
%%comment_form%%, %%comments_form%% The comment form without the existing comment list.
%%commentsId%%, %%comments_id%%, %%id%% The legacy comment thread ID.
%%entrypage%% The diary entry URL from a comment template.
%%comment%% The comment body and its absolute and relative dates.
%%signername%%, %%signerusername%% The comment author display name and Diaryland username.
%%signerurl%%, %%signeremail%% The author profile URL and legacy email field, when present.

Daily prompts

The entry part inserts the prompt collection, and the daily-prompt row part controls each answer.

Tag or path What it provides
%%prompts%% Daily prompt answers attached to the entry.
%%promptLabel%% The prompt label inside the daily-prompt row part.
%%promptAnswer%% The rendered answer inside the daily-prompt row part.
%%promptDate%% The prompt date inside the daily-prompt row part.

Compatibility tags and aliases

Older Diaryland templates may use these alternate spellings. They remain supported so an established design does not need to be rewritten.

Tag or path What it provides
%%diary-username%% A link to another Diaryland diary. Replace username in the tag with the diary name.
%%entry_option_1%% ... %%entry_option_4%% Alternate names for the four optional legacy entry fields.
{$d_entry}, {$d_page_name}, {$d_short_description}, {$d_date}, {$d_time} Classic row-template aliases for entry body, URL, title, date, and time.
{$DiaryLand::username}, {$DiaryLand::entry_title}, {$DiaryLand::entries} Compatibility aliases for the username, current title, and rendered entries.
{$DiaryLand::comments}, {$DiaryLand::tags} Compatibility aliases for comments and the linked tag list.
{$DiaryLand::recent_entries}, {$DiaryLand::older_entries} Compatibility aliases for recent and older entry lists.
{$DiaryLand::archive}, {$DiaryLand::archives} Compatibility aliases for the complete archive list.
{$DiaryLand::pages}, {$DiaryLand::diary_pages} Compatibility aliases for the linked list of diary pages.
{$DiaryLand::option1} ... {$DiaryLand::option4} Alternate names for the four optional legacy entry fields.
%%gold_stats%% A retired compatibility tag. It is accepted but intentionally renders nothing.
Rendering behaviour

Values are escaped

Ordinary values are HTML-escaped before they are printed. Entry bodies, prompt answers, and built-in comment blocks are prepared as safe HTML by Diaryland.

Missing values show nothing

A value that does not apply to the current page usually renders as an empty string or an empty list. This lets one V2 document serve several page types.

Private entries stay private

Public pages and collections omit private entries. When the diary owner is signed in, private entries and tags used only by private entries can appear.

Mistakes will not break your diary

Unknown V2 values print nothing. Malformed structural tags are left visible where possible so the template can be repaired instead of producing a server error.