Print container ID and CSS class in a content template

Matrix Version:5.5.6

Is it possible to print the custom ID (not asset ID, but the ID you can set in the Container Properties panel) and the class names of a content container in a template using keywords?

Hi I have the same question, is there keyword to pull in the custom css class added under Properties > Advanced?

Hi @John

No, you cannot print the custom Container ID or the custom class names using keywords.

You can print the Content Container’s asset ID, but not the custom “Container Properties → ID” or “CSS Classes” fields.

You can print the Content Container’s Asset ID using:

%asset_assetid%

This lets you generate a unique ID for styling or JS hooks, for example:

<div id="container-%asset_assetid%">

You can use metadata instead to create metadata field for “container ID” or “container class” Metadata can then be printed with keywords.

You could also use the container’s Asset Name or Asset ID to generate predictable classes or IDs.