User Guides

Tokens Configuration

The tokens config allows you to modify existing and define new dynamic segment tokens. For more information on dynamic segments, see the 'Dynamic Segments' section of Routes Configuration.

To override the default configuration, create a new config file named tokens.yaml in your chosen configuration directory.


Existing Tokens

The existing tokens can be found in the table below along with descriptions and the default values.

Token Base value (default) Description
int [0-9]{1,} Integers
word [a-z]{1,} Letters a-z
slug [a-z0-9-]{1,} Alphanumeric characters and hyphens
year [0-9]{4} Four-digit year
wild .{1,} Wildcard, minimum of one character
day_long monday|tuesday|wednesday|thursday|friday|saturday|sunday Days (Long)
day_short mon|tue|wed|thu|fri|sat|sun Days (Short)
month_long january|february|march|april|may|june|july|august|september|october|november|december Months (Long)
month_short jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec Months (Short)

Custom Tokens

To create a custom token, you must create a new tokens.yaml file. In that file you will define a key which will be the name of your new token, and a value which will be the regular expression used to validate your token.

myCustomToken: SomeRegularExpression
myOtherCustomToken: SomeOtherRegularExpression

You can also overwrite existing token as follows:

word: SomeRegularExpression