Tokens are a great way to add a content item that appears in several places on your site. This could be a small piece of content, like a rate, or a larger piece of content, like a disclosure or a table. When you update the token in the backend of the CMS, it updates everywhere the token exists on the website.
NOTE: You must create tokens BEFORE adding them to a content page.
How to create a custom token
To create a new token on your site, please follow the below steps:
- Navigate to “Custom Tokens” under the “Structure” main nav.
- Once on this page, click on “Add token.”
- Once on the editing page, you will need to fill out the information. Be mindful of formatting.
Token type (A) – While this is not showing as a required field, you must fill it out. Select the most appropriate option. Examples include rates, phone, and custom.
Token name (B) – This is a required field. It should be short and to the point. For example, “Home Loan”.
Machine name ID (C) – This is a required field. This is a unique machine-readable name for the new token. It must contain lowercase letters, numbers, and underscores. For example, “home_loan”
Token description (D) – Typically, this is the same as the Token name. For example, “Home Loan.”
Content (E) – Add the content that you want pulled in when the token is referenced in the content. For example, if this is a non-API rate, then 2.95. Be sure to include EXACTLY what you want pulled in.
4. Be sure to update the Text format dropdown (F) to “Full HTML”.
5. Scroll to the bottom of the page and Save(G).
Once you have a token set up, then you can add it to a page. You can also use the token tool in the CKEditor.
How to use a custom token within content
When adding a custom token to a page, there are two ways to do it:
1. Manually type the custom token using the token type name and the token's machine name.
When adding a token to a page, use this format “[Token Type: Machine Name]”. Per the example noted above, you would type [rates:home_loan] into the pages that require the home loan rate token.
2. Use the Token browser in the CKEditor toolbar.
This method allows you to search for the token by name and add it to the content.
Click on the token browser icon in the CKEditor toolbar.
A popup will appear that allows you to drill-down into all of the tokens that are available on your site.
Click on the blue token link that you would like to insert. The token is automatically placed where your cursor was inside the CKEditor. Note: The popup doesn't close automatically. Close it manually to get back to the CKEditor.