Blot

Reference

Blot templates use Mustache syntax. {{value}} HTML-escapes output, while {{{value}}} renders unescaped HTML (use sparingly and only for trusted HTML). Section blocks like {{#entry}}...{{/entry}} switch context to the nested object inside the block. Site properties are available in the top level context.

Site properties

title

Your site’s title, set on the Title page of your dashboard.

<h1>{{title}}</h1>
<h1>My Site</h1>

avatar

The URL to your profile picture, or avatar, uploaded on the Photo page of your dashboard

<img src="{{{avatar}}}" />
<img src="https://example.com/avatar.jpg" />

menu

A list of links in your site's navigation. This list includes links you add on the Links page of your dashboard, plus links for pages (entries with menu metadata) when present. Each item in the list has the following properties:

id

Unique identifier for this link

label

Text label for this link

url

URL for this link

metadata

The metadata set for the page which generated this link.

active

true if you are currently looking at this link

first

true if this link is the first in your menu

penultimate

true if this link is the penultimate link in your menu

last

true if this link is the last in your menu

{{#menu}}
<a href="{{url}}">{{label}}</a>
{{/menu}}
<a href="/">Home</a>
<a href="/about">About</a>
...

cacheID

A Unix timestamp in milliseconds for when your site was last updated.

{{cacheID}}
1707096312000

updated

Used to display the time your site was last updated, using the property directly or by passing in any of the supported date tokens.

Updated on {{updated}}.

Updated on {{#updated}}MMMM DDDo, YYYY{{/updated}}.
Updated on 2024-02-01
Updated on February 1st, 2024

timezone

Your site’s timezone in the tz database format

siteURL

URL to your site’s homepage

blogURL

Alias for siteURL

feedURL

Relative path to your site's RSS feed (prepend siteURL for a fully qualified URL).

/feed.rss

sitemapURL

Relative path to your site's sitemap (prepend siteURL for a fully qualified URL).

/sitemap.xml

roundAvatar

true if you’ve indicated your avatar is round, false if not

Entry properties

Identity

Core identifiers and naming fields. These are present for entries unless noted otherwise.

id

Alias for the path property, which uniquely identifies the post.

guid

Globally unique alpha-numeric identifier for the post.

html

The full HTML of the blog post.

path

The file’s path, with the blog’s folder as root.

title

The blog post’s title.

URLs

URL fields for resolved paths and canonical links.

url

The resolved, unique URL to the post.

tags

List of tags for the entry. Each item in the list has the following properties:

tag

Text for the tag

name

Alias for tag

slug

URL-friendly version of the tag

url

Relative URL to this tag page.

first

true if this tag is the first in this entry's list of tags

last

true if this link is the last in this entry's list of tags

{{#entry.tags}}
<a href="{{url}}">{{tag}}</a>
{{/entry.tags}}

absoluteURL

The fully qualified URL (scheme + host + path) to the post.

https://example.com/2024/hello-world

Dates

Publication and file lifecycle timestamps.

date

The blog post’s publication date, as a human-readable string. This is only present when hide_dates is false and the entry is not a menu item or page. Use formatDate for custom formatting regardless of display settings.

dateStamp

The blog post's publication date, as a Unix timestamp in milliseconds.

1707096312000

A list of all the entries on your site which link to this entry. Each item in the list is an entry.

{{#backlinks}}
<a href="{{url}}">{{title}}</a>
{{/backlinks}}

formatDate

Used to format the entry's publication date as you like, using any of the supported date tokens.

{{#formatDate}}
MMMM DDDo, YYYY 
{{/formatDate}}

formatUpdated

Used to format the entry's updated date as you like, using any of the supported date tokens.

{{#formatUpdated}}
MMMM DDDo, YYYY 
{{/formatUpdated}}

formatCreated

Used to format the entry's created date as you like, using any of the supported date tokens.

{{#formatCreated}}
MMMM DDDo, YYYY 
{{/formatCreated}}

thumbnail

Object containing the thumbnails for the entry, if they exist. Blot will not increase the size of smaller images. When a thumbnail is generated, each size (small, medium, large, square) is present; if the source image is smaller than a size limit, the thumbnail is still generated at the source image’s dimensions (no upscaling).

small

Thumbnail with width and height under 160px.

small.url

Relative URL to the generated small thumbnail image.

small.width

Width of the generated small thumbnail in pixels.

small.height

Height of the generated small thumbnail in pixels.

medium

Default thumbnail variant with width under 640px.

medium.url

Relative URL to the generated medium thumbnail image.

medium.width

Width of the generated medium thumbnail in pixels.

medium.height

Height of the generated medium thumbnail in pixels.

large

Thumbnail with width and height under 1200px (or smaller if the source image is smaller).

large.url

Relative URL to the generated large thumbnail image.

large.width

Width of the generated large thumbnail in pixels.

large.height

Height of the generated large thumbnail in pixels.

square

Square thumbnail variant, typically 160px by 160px.

square.url

Relative URL to the generated square thumbnail image.

square.width

Width of the generated square thumbnail in pixels.

square.height

Height of the generated square thumbnail in pixels.

{{#thumbnail.medium}}
  <img src="{{url}}"
       width="{{width}}"
       height="{{height}}"/>
{{/thumbnail.medium}}

metadata

object containing the metadata for the entry, if they exist.

exif

Sanitized EXIF metadata populated for image-based entries when EXIF preservation is enabled. Configure this in your dashboard at Settings → Images → Image metadata (EXIF). Default mode for new sites is basic. Use off to disable EXIF, basic for a privacy-preserving subset, or full to expose all parsed keys (including GPS fields). ImageDescription is rendered as inline Markdown (bold, italic, links and code), so print it with triple braces: {{{ImageDescription}}}.

{{#entry.exif}}
{{Make}} {{Model}} — {{ExposureTime}}s at ƒ/{{FNumber}}, ISO {{ISO}}
{{/entry.exif}}

Basic mode keys:
  - Make
  - Model
  - ExposureTime
  - FNumber
  - ISO
  - FocalLength
  - LensMake
  - LensModel
  - ImageDescription

Full mode also includes:
  - GPSLatitude
  - GPSLongitude
  - GPSAltitude
  - GPSPosition

name

The file’s name, preserving the case where possible.

size

The file’s size in bytes.

created

The timestamp when the entry was added to Blot, as a Unix timestamp in milliseconds. For the publication date (often derived from metadata or the file path), see entry.dateStamp.

1707096312000

updated

The file's last-modified date, as a Unix timestamp in milliseconds.

1707096312000

summary

Plain text extracted from rendered content, excluding headings (h1-h6), fenced/code blocks (pre, code), and non-content structural elements. Whitespace is normalized, then the result is truncated to approximately 150 characters as a heuristic summary target.

titleTag

If the post’s title was generated from a heading in the blog post, this property contains that heading’s HTML. For example: <h1>Your post's <em>nice</em> title</h1>

body

The HTML of the blog post, excluding the titleTag. This property is useful if you want to manipulate the HTML of the titles of your blog posts.

teaser

The HTML of the title and the first few items in the entry. You can specify the end of the teaser by inserting the special tag {{more}} into your blog post's file. Everything before more will be included in the teaser.

teaserBody

The HTML of the first few items in the entry, excluding the title. Equivalent to teaser without the titleTag.

more

A boolean value indicating if the post’s teaser property is different to its html property. This is useful for determining whether or not to show 'read more' links.

slug

A slug derived from the title or path, which may be used to build the permalink.

The requested, format-based permalink candidate before it is resolved to the final URL.

index

1-based publication-order index among published entries in chronological order (oldest published entry is 1; newest has the largest index). Draft and deleted entries are excluded.

menu

“true” if the entry is a page on the menu, “false” if not

page

“true” if the entry is a page, “false” if not

deleted

“true” if the entry is deleted, “false” if not

draft

“true” if the entry is a draft, “false” if not

scheduled

“true” if the entry is scheduled for future publication, “false” if not

Lists of entries

recent_entries

A list of the 30 most recent entries on your site. Each item in the list is of type entry.

{{#recent_entries}}
<a href="{{url}}">{{title}}</a>
{{/recent_entries}}

all_entries

A list of all the entries on your site. Each item in the list is of type entry.

{{#all_entries}}
<a href="{{url}}">{{title}}</a>
{{/all_entries}}

Pagination

Pagination is applied on tagged routes (/tagged/:slug and /tagged/:slug/page/:page) and on entry list routes that set page_size. Each list of entries carries its own pagination object, read as posts.pagination (or entries.pagination on entries.html and tagged.html, or tagged.pagination), with current, previous, next, next_url, previous_url, total, page_size, and total_entries. next and previous are page numbers; next_url and previous_url are the URLs of those pages of the same listing (/page/2, /tagged/foo/page/2, or a template view's own :page URL pattern, else the same URL with ?page=2 and the other query parameters kept), and null when there is no such page. Page 1 is the listing's own URL, never /page/1. Use it outside the list, after {{/posts}}: inside the loop the names refer to the current entry. It renders even when the list is empty. Older templates use a top-level pagination, which is the pagination of the list the URL pages, or {{#pagination}} inside the loop, which renders once after the last entry; both still work. Defaults and limits: page_size uses a baseline of 5 with valid values 1-100; tagged routes prefer tagged_page_size over page_size, and use an effective default of 100 when unset, invalid, or outside 1-500.

{{#entries}}<a href="{{{url}}}">{{title}}</a>{{/entries}}
{{#entries.pagination}}
{{#next_url}}<a href="{{next_url}}">Older</a>{{/next_url}}
{{#previous_url}}<a href="{{previous_url}}">Newer</a>{{/previous_url}}
{{/entries.pagination}}

archives

A list of all the entries on your site, structured by date. Each item in the entries property of each month is of type entry.

year

The year

total

The number of entries in this year

s

's' if the year has more than one entry. Use it for pluralization.

months

A list of month groups in this year.

months.month

Month label for this group.

months.entries

List of entry objects published in this month.

{{#archives}}
  <h2>{{year}} ({{total}} post{{s}})</h2>
  {{#months}}
    <h3>{{month}}</h3>
    {{#entries}}
    <a href="{{url}}">{{title}}</a>
    {{/entries}}
  {{/months}}
{{/archives}}

Tagged entry lists

The tagged.html template is rendered for /tagged/:tag. Use {{#tagged}}...{{/tagged}} to access the tag page context, including tag, entries, total, slugs, and prettyTags.

When filtering entries inside another list, use entry.tagged.<tag> (or tagged.<tag> from within an entry context), as shown in the tag-filter example template.

Tag identifiers are case-insensitive and can be either the original tag text (Apple) or its slug (apple, multi-word).

{{#tagged}}
  <h1>{{tag}} ({{total}})</h1>
  {{#entries}}
  <a href="{{url}}">{{title}}</a>
  {{/entries}}
{{/tagged}}

{{#all_entries}}
  {{#entry.tagged.Apple}}
  <a href="{{url}}">{{title}}</a>
  {{/entry.tagged.Apple}}
{{/all_entries}}

<a href="/tagged/Apple">Apple</a>
<a href="/tagged/apple">apple</a>
<a href="/tagged/multi-word">multi-word</a>

Lists of tags

all_tags

A list of all the tags used on your site, sorted alphabetically by tag text.

tag

The tag text

slug

The tag text, in a URL-friendly form

url

Relative URL to this tag page.

entries

A list of every entry with this tag in reverse-chronological order.

total

The number of entries with this tag.

{{#all_tags}}
<a href="/tagged/{{slug}}">{{tag}}</a><br>
{{/all_tags}}

A list of all the tags used on your site, sorted by the number of entries with each tag.

tag

The tag text

slug

The tag text, in a URL-friendly form

url

Relative URL to this tag page.

entries

A list of every entry with this tag in reverse-chronological order.

total

The number of entries with this tag.

{{#popular_tags}}
<a href="/tagged/{{slug}}">{{tag}}</a><br>
{{/popular_tags}}

Utilities

Utilities usage

Utilities can be used either as literal values (for example {{cdn}}) or as section/block helpers ({{#helper}}...{{/helper}}) that transform the block contents.

<link rel="preconnect" href="{{{cdn}}}" />
{{#encode_xml}}{{title}}{{/encode_xml}}

absolute_urls

The same contents, with any relative URLs fully resolved. This is useful to create an RSS feed, since many clients struggle with relative URLs. For example

{{#absolute_urls}}
{{{html}}}
{{/absolute_urls}}

encode_json

The same contents, encoded appropriately for JSON. This is useful to create a JSON feed. You can use it like this

{{#encode_json}}
{{{html}}}
{{/encode_json}}

encode_uri_component

This is useful for forming urls from entry properties

?text={{#encode_uri_component}}
{{title}}
{{/encode_uri_component}}

encode_xml

The same contents, encoded appropriately for XML. This is useful to create a RSS feed. You can use it like this

{{#encode_xml}}
{{{html}}}
{{/encode_xml}}

rgb

Extracts the r, g, and b values for a passed color. Returns these values joined by a comma.

color:rgba({{#rgb}}#FF00FF{{/rgb}},0.5);

light_or_dark

Returns light or dark for a passed color, so a template can adjust its contrast, or set the CSS color-scheme, to suit whichever background the blog uses. A color is dark when its perceived brightness is below half; transparency is ignored. A value that isn't a color returns nothing.

<html data-scheme="{{#light_or_dark}}{{background_color}}{{/light_or_dark}}">

html { color-scheme: {{#light_or_dark}}{{background_color}}{{/light_or_dark}}; }
[data-scheme="light"] .tag { background: rgba(0, 0, 0, 0.06); }
[data-scheme="dark"] .tag { background: rgba(255, 255, 255, 0.16); }

cdn

Used to generate CDN URLs for template view files, especially useful for JS and CSS. When used literally e.g. {{cdn}} it returns the CDN origin URL. When used as a section helper, e.g. {{#cdn}}/path/to/file{{/cdn}} the helper returns the URL to the view file on the CDN.

<link rel="preconnect" href="{{{cdn}}}" />
<link rel="stylesheet" href="{{#cdn}}/style.css{{/cdn}}">

plugin

Provides access to public CSS/JS payloads for specific plugins, so you can load only what you need. The helper respects your blog's plugin settings and returns nothing for missing, disabled, or asset-less plugins.

<pluginKey>.css

Public CSS emitted by the plugin when available.

<pluginKey>.js

Public JavaScript emitted by the plugin when available.

known keys

analytics, autoImage, bluesky, codeHighlighting, disqus, externalLinks, flickr, image, imageCaption, injectTitle, katex, linebreaks, mediaPreload, linkScreenshot, titlecase, twitter, typeset, videoEmbeds, wikilinks, zoom

<style>{{{plugin.katex.css}}}</style>

Date tokens

Token Output
Month M 1 2 … 11 12
Mo 1st 2nd … 11th 12th
MM 01 02 … 11 12
MMM Jan Feb … Nov Dec
MMMM January February … November December
Quarter Q 1 2 3 4
Qo 1st 2nd 3rd 4th
Day of Month D 1 2 … 30 31
Do 1st 2nd … 30th 31st
DD 01 02 … 30 31
Day of Year DDD 1 2 … 364 365
DDDo 1st 2nd … 364th 365th
DDDD 001 002 … 364 365
Day of Week d 0 1 … 5 6
do 0th 1st … 5th 6th
dd Su Mo … Fr Sa
ddd Sun Mon … Fri Sat
dddd Sunday Monday … Friday Saturday
Day of Week (Locale) e 0 1 … 5 6
Day of Week (ISO) E 1 2 … 6 7
Week of Year w 1 2 … 52 53
wo 1st 2nd … 52nd 53rd
ww 01 02 … 52 53
Week of Year (ISO) W 1 2 … 52 53
Wo 1st 2nd … 52nd 53rd
WW 01 02 … 52 53
Year YY 70 71 … 29 30
YYYY 1970 1971 … 2029 2030
Y 1970 1971 … 9999 +10000 +10001
Note: This complies with the ISO 8601 standard for dates past the year 9999
Week Year gg 70 71 … 29 30
gggg 1970 1971 … 2029 2030
Week Year (ISO) GG 70 71 … 29 30
GGGG 1970 1971 … 2029 2030
AM/PM A AM PM
a am pm
Hour H 0 1 … 22 23
HH 00 01 … 22 23
h 1 2 … 11 12
hh 01 02 … 11 12
k 1 2 … 23 24
kk 01 02 … 23 24
Minute m 0 1 … 58 59
mm 00 01 … 58 59
Second s 0 1 … 58 59
ss 00 01 … 58 59
Fractional Second S 0 1 … 8 9
SS 00 01 … 98 99
SSS 000 001 … 998 999
SSSS … SSSSSSSSS 000[0..] 001[0..] … 998[0..] 999[0..]
Time Zone z or zz EST CST … MST PST
Z -07:00 -06:00 … +06:00 +07:00
ZZ -0700 -0600 … +0600 +0700
Unix Timestamp X 1360013296
Unix Millisecond Timestamp x 1360013296123