Tokens
A token is a placeholder that resolves to a value at render time. They appear in address patterns, meta tags, mail and PDF templates.
The shape
[provider:what]
[provider:what:more]
| Provider | Gives you |
|---|---|
record |
The record being rendered |
term |
A taxonomy term |
site |
The site |
org |
The organization |
Examples
| Token | Resolves to |
|---|---|
[record:title] |
The record's title |
[record:field:sku] |
The value of the sku field |
[record:field:category] |
The label of a referenced term |
[record:field:category:path] |
That term's place in the hierarchy, as path segments |
[record:field:product:path] |
The referenced record's canonical address |
[site:name] |
The site's name |
[org:name] |
The organization's name |
Chaining
A reference field can be followed into its target:
[record:field:manufacturer:field:country] reads the country from the
manufacturer the record points at.
Address patterns
Patterns are the most valuable use. A variation addressed as
[record:field:product:path]/[record:field:sku]
sits under its product wherever the product moves, without anybody maintaining a list.
The `:path` suffix is a declared hierarchy, not a string
It asks the platform where the thing lives. Concatenating labels yourself produces something that looks the same and stops being right the first time an alias, a pattern or a translated term is involved.
Missing values
A token whose value is empty resolves to nothing and the surrounding text closes up. Design patterns so that a missing optional value leaves a sensible address rather than a double slash.