Skip to content

Tokens

Values for post and media paths in post type configuration can be customised using placeholder tokens.

For example, given the following properties for a note post:

js
{
  published: "2020-02-02",
  name: "What I had for lunch",
  content: "I ate a cheese sandwich, which was nice.",
}

would, with the path _journal/{yyyy}-{MM}-{dd}-{slug}.md, output:

txt
_journal/2020-02-02-what-i-had-for-lunch.md

Path and URL tokens

Tokens are available for a number of file properties, with many allowing you to use parts of the published or uploaded date in generated paths and URLs:

TokenDescription
yCalendar year, for example 2020
yyyyCalendar year (zero-padded), for example 2020
MMonth number, for example 9
MMMonth number (zero-padded), for example 09
MMMMonth name (abbreviated), for example Sep
MMMMMonth name (wide), for example September
wWeek number, for example 1
wwWeek number (zero-padded), for example 01
DDay of the year, for example 1
DDDDay of the year (zero-padded), for example 001
D60Day of the year (sexageismal), for example 57h
dDay of the month, for example 1
ddDay of the month (zero-padded), for example 01
hHour (12-hour-cycle), for example 1
hhHour (12-hour-cycle, zero-padded), for example 01
HHour (24-hour-cycle), for example 1
HHHour (24-hour-cycle, zero-padded), for example 01
mMinute, for example 1
mmMinute (zero-padded), for example 01
sSecond, for example 1
ssSecond (zero-padded), for example 01
tUNIX epoch seconds, for example 512969520
TUNIX epoch milliseconds, for example 51296952000
nIncremental count of posts (for type) in the same day, for example 1. This token requires a database to be configured.

Post file tokens

The following tokens are only available for post files:

TokenDescription
slugSlug provided in mp-slug property, else slugified name property, else a 5 character string, for example ycf9o

Media file tokens

The following tokens are only available for media files:

TokenDescription
extFile extension of uploaded file, for example jpg
filenameSlugified name of uploaded file, for example flower_1.jpg for a file with the original name Flower 1.jpg.
md5MD5 checksum of the uploaded file, for example be7d321488de26f2eb38834af7162164