Tokens available in Drupal core

Last updated on
19 April 2025

This documentation needs review. See "Help improve this page" in the sidebar.

The following tokens are available in Drupal core.

Comment

Token Token name Description
[comment:cid]
Comment ID The unique ID of the comment.
[comment:hostname]
IP Address The IP address of the computer the comment was posted from.
[comment:mail]
Email address The email address left by the comment author.
[comment:homepage]
Home page The home page URL left by the comment author.
[comment:title]
Title The title of the comment.
[comment:body]
Content The formatted content of the comment itself.
[comment:langcode]
Language code The language code of the language the comment is written in.
[comment:url]
URL The URL of the comment.
[comment:edit-url]
Edit URL The URL of the comment's edit page.
[comment:created]
Date created The date the comment was posted.
[comment:changed]
Date changed The date the comment was most recently updated.
[comment:parent]
Parent The comment's parent, if comment threading is active.
[comment:entity]
Entity The entity the comment was posted to.
[comment:author]
Author The author name of the comment.

Chainable

Token Token name Description
[comment:entity:?]
Entity The entity the comment was posted to, treated as whatever kind of entity the token is, such as Node.
[comment:created:?]
Date created The date the comment was posted, treated as a Date token.
[comment:changed:?]
Date changed The date the comment was most recently updated, treated as a Date token.
[comment:parent:?]
Parent The comment's parent, treated as a Comment token.
[comment:author:?]
Author The author of the comment, treated as a User token.

File

Token Token name Description
[file:fid]
File ID The unique ID of the uploaded file.
[file:name]
File name The name of the file on disk.
[file:path]
Path The location of the file relative to Drupal root.
[file:mime]
MIME type The MIME type of the file.
[file:size]
File size The size of the file.
[file:url]
URL The web-accessible URL for the file.
[file:created]
Created The date the file created.
[file:changed]
Changed The date the file was most recently changed.
[file:owner]
Owner The user who originally uploaded the file.

Chainable

Token Token name Description
[file:created:?]
Created The date the file , treated as a Date token.
[file:changed:?]
Changed The date the file was most recently changed, treated as a Date token.
[file:owner:?]
Owner The user who originally uploaded the file, treated as a User token.

Node

Token Token name Description
[node:nid]
Content ID The unique ID of the content item, or "node".
[node:vid]
Revision ID The unique ID of the node's latest revision.
[node:type]
Content type The node's type as a machine name.
[node:type-name]
Content type name The human-readable name of the node type.
[node:title]
Title The node's title.
[node:body]
Body The main body text of the node.
[node:summary]
Summary The summary of the node's main body text.
[node:langcode]
Language code The language code of the language the node is written in.
[node:published_status]
Published The publication status of the node ("Published" or "Unpublished").
[node:url]
URL The URL of the node.
[node:edit-url]
Edit URL The URL of the node's edit page.
[node:created]
Date created The date the node was created.
[node:changed]
Date changed The date the node was most recently updated.
[node:author]
Author The display name for the node's author.

Chainable

Token Token name Description
[node:author:?]
Author The node's author, treated as a User token.
[node:created:?]
Date created The date the node was created, treated as a Date token.
[node:changed:?]
Date changed The date the node was most recently updated, treated as a Date token.

Requires Comment module

Token Token name Description
[node:comment-count]
Comment count The number of comments posted on an entity.
[node:comment-count-new]
New comment count The number of comments posted on an entity since the reader last viewed it.

Requires Statistics module

Token Token name Description
[node:total-count]
Total views count The number of times this node has been viewed.
[node:day-count]
Last day views count The number of times this node has been viewed in the last day.
[node:last-view]
Last viewed time The last time this node was viewed. Can be chained as a Date module. If node has never been viewed, will return "never".

Site

Token Token name Description
[site:name]
Name The name of the site.
[site:slogan]
Slogan The slogan of the site.
[site:mail]
Email The administrative email address for the site.
[site:base-url]
Base URL The base URL of the site. eg. https://mysite.example.org
[site:base-path]
Base path The base path of the site.
Will be blank if running Drupal directly off the domain.
If Drupal is running at a specific path, that path will be returned.
[site:url]
URL The URL of the site's front page with the language prefix, if it exists.
[site:url-brief]
URL (brief) The URL of the site's front page without the protocol.
[site:login-url]
Login page The URL of the site's login page.

Date

Token Token name Description
[date:short]
Short format The current date in 'short' format. eg. 04/19/2025 - 14:13
[date:medium]
Medium format The current date in 'medium' format. eg. Sat, 04/19/2025 - 14:13
[date:long]
Long format The current date in 'long' format. eg. Saturday, April 19, 2025 - 14:13
[date:custom:?]
Custom format The current date in a custom format. See the PHP documentation for details.
For example, [date:custom:Y-m-d] prints a date formatted like 2025-04-19.
[date:since]
Time-since The current date in 'time-since' format. eg. 6 minutes
[date:raw]
Raw timestamp The current date in UNIX timestamp format eg. 1745071981

Taxonomy term

Token Token name Description
[term:tid]
Term ID The unique ID of the taxonomy term.
[term:name]
Name The name of the taxonomy term.
[term:description]
Description The optional description of the taxonomy term.
[term:node-count]
Node count The number of nodes tagged with the taxonomy term.
[term:url]
URL The URL of the taxonomy term.
[term:vocabulary]
Vocabulary The vocabulary the taxonomy term belongs to.
[term:parent]
Parent term The parent term of the taxonomy term, if one exists.
[term:changed]
Date changed The date the taxonomy was most recently updated.

Chainable

Token Token name Description
[term:vocabulary:?]
Vocabulary The vocabulary the taxonomy term belongs to, treated as a Vocabulary token.
[term:parent:?]
Parent term The parent term of the taxonomy term, treated as a Taxonomy Term token.
[term:changed:?]
Date changed The date the taxonomy was most recently updated, treated as a Date token.

Vocabulary

Token Token name Description
[vocabulary:vid]
Vocabulary ID The unique ID of the taxonomy vocabulary.
[vocabulary:name]
Name The name of the taxonomy vocabulary.
[vocabulary:description]
Description The optional description of the taxonomy vocabulary.
[vocabulary:node-count]
Node count The number of nodes tagged with terms belonging to the taxonomy vocabulary.
[vocabulary:term-count]
Term count The number of terms belonging to the taxonomy vocabulary.

User

Token Token name Description
[user:uid]
User ID The unique ID of the user account.
[user:account-name]
Account Name The login name of the user account.
[user:display-name]
Display Name The display name of the user account.
[user:name]
User Name Deprecated: Use account-name or display-name instead.
[user:mail]
Email The email address of the user account.
[user:url]
URL The URL of the account profile page.
[user:edit-url]
Edit URL The URL of the account edit page.
[user:last-login]
Last login The date the user last logged in to the site.
[user:created]
Created The date the user account was created.

Chainable

Token Token name Description
[user:last-login:?]
Last login The date the user last logged in to the site, treated as a Date token.
[user:created:?]
Created The date the user account was created, treated as a Date token.

Current user

The Current user tokens are identical to the User tokens, but they relate to the currently logged-in user and are prefixed with current-user.

eg. [current-user:uid][current-user:display-name]

View

Token Token name Description
[view:label]
Label The label of the view.
[view:description]
Description The description of the view.
[view:id]
ID The machine-readable ID of the view.
[view:title]
Title The title of current display of the view.
[view:url]
URL The URL of the view.
[view:base-table]
Base table The base table used for this view.
[view:base-field]
Base field The base field used for this view.
[view:total-rows]
Total rows The total amount of results returned from the view.
The current display will be used.
[view:items-per-page]
Items per page The number of items per page.
[view:current-page]
Current page The current page of results the view is on.
[view:page-count]
Page count The total page count.

Help improve this page

Page status: Needs review

You can: