Keyword replacements
A keyword replacement lets you print information about an asset within the site’s content. This information the keyword prints updates as the source information updates.
By using keyword replacements throughout your site, you can significantly reduce the need to update core information on your site manually.
How do keyword replacements work?
Keyword replacements use the percentage (%
) symbol as a keyword marker, with a keyword value specified between the marker.
For example: %<keyword_replacement>%
When the system finds a term between the %
markers, it validates against a known list of keyword replacements. It replaces the keyword with the correct information.
If the system can not match the keyword syntax, the content remains unprocessed.
How can I benefit from keyword replacements?
If you use the keyword replacement %asset_name%
, the asset’s name appears where you set the keyword replacement.
If you change the asset’s name, the information displayed is updated instantly.
You can also use keyword replacements to display asset elements within the content. For example, when creating a custom form, you can use keyword replacements to layout the form.
What are global keyword replacements?
Along with the keyword replacements for assets, there are global keywords. You can use these keywords on any asset within the system, including the Design asset. Global keywords show information such as the current asset the user is viewing, the current site they are viewing, or information from their user account (for users signed in to Matrix).
For example, suppose you want to show the asset’s name that the user is currently viewing within the design. In that case, you can use the global keyword %globals_asset_name%
.
You can learn more about the available keyword modifiers by reading the Global keywords documentation.
What are keyword modifiers?
You can modify the returned values of all keyword replacements by using keyword modifiers.
These modifiers are represented as extensions added to the existing keyword replacement using the ^
symbol.
For example, suppose you want to show the first ten words from the content of a page. You can use the keyword replacement %asset_contents%
, combined with the modifier ^maxwords:
to create the modified keyword of %asset_contents^maxwords:10%
.
You can learn more about the available keyword modifiers by reading the Keyword modifiers documentation.
Reserved keyword replacement formats
Some keyword replacement prefixes are reserved for specific purposes. These prefixes include:
-
%begin_*%
-
%else_*%
-
%end_*%
-
%globals_*%
Take care when assigning field names and field values that could generate automatic keywords that conflict with these reserved keyword formats.