How to Use Tokens in the Title of a View in Drupal?

| | 1 min read

Views in Drupal allow tokens in the view's title. This allows site builders to create dynamic and context-aware titles for view blocks or pages. 

But there is no hint/help text in the title field that we can use tokens when setting the view's title. As a result, many developers resort to a workaround by setting the views title to "None" and adding a Global: Text area in the Header, where they use the tokens in the replacement patterns.

Add token in views title

Latest Drupal releases can render tokens directly in the views title field, eliminating the need for a workaround. You just need to put the token directly in the title field. All tokens available in the replacement patterns are available to use with the title.