Adding tokens to content

Add tokens to any content to make the content more dynamic. When content containing a token is displayed, the token is replaced by text that can be calculated at that moment, based on information that includes the current date, site details, and more. For example, you could insert the token [site:mail] in a blog post and when the blog post is displayed, the administrative email address for the website appears in the blog post.

Enabling tokens

When you enter data to a field with a formatting toolbar, you can select from any of the available text formats for its content. The text format you choose specifies how to display your content, including whether or not to replace any tokens you enter with their associated value.

To configure a text format to enable tokens:

  1. Go to Configuration > Text formats, and click the configure link for the text format that you want to modify (for example, Full HTML).
  2. In the Enabled filters section, select the Replace tokens check box.
  3. Click Save configuration.

You can now use tokens with fields that use a configured text format.

Adding tokens to fields

After you modify one or more text formats to replace the tokens you enter with their values, you can use tokens with your content.

Note: You can only use tokens in fields where the content type is configured to filter text. Not all fields can filter entered text. For more information about content type fields, see Custom and customized content types.

To add a token to a field:

  1. In the admin menu, click Content, and then click the Add content link.

    Add content link

  2. Click the name of the content type that you want to modify. Be sure that content type contains a field that allows the use of tokens, which usually includes the Body field (for example, the Blog entry content type).
  3. Find the field to which you want to add tokens (in this example, the Body field), and then select the text format that you configured to replace tokens (for example, Full HTML from the previous section).

    Text format menu

  4. Add tokens to the field and they will be replaced with the token values.

    For a list of available tokens, click the More information about text formats link.

    Available tokens link

Adding tokens to notification emails

For information about using tokens with notification emails to your users, see the Using tokens with notification emails section of Webforms.