Thymeleaf dialect
Expression objects
Render utilities
The WebCmsRenderUtilityService
is available as the #wcm
expression object.
/**
* Build the local application url for a particular asset.
*/
${#wcm.url(asset)}
/**
* Render the image url for either a WebCmsImage or a ImageWebCmsComponentModel.
*/
${#wcm.imageUrl(image)}
${#wcm.imageUrl(image,maxWidth,maxHeight)}
/**
* Get components from the WebCmsComponentModelHierarchy of the current request.
*/
${#wcm.component(componentName)}
${#wcm.componentFromScope(componentName,scopeName)}
${#wcm.componentFromScope(componentName,scopeName,searchParentScopes)}
/**
* Access container component members without exceptions if they are unavailable.
* Supports proxy components that point to an actual container.
*/
${#wcm.member(componentName,container)}
${#wcm.members(container)}
HTML attributes
The following HTML attributes are supported.
Attributes for rendering components
wcm:component |
The body of the element will be replaced with the rendering of the component, if the component is found. |
wcm:scope |
Specify the name of the scope in which the component should be looked for - if omitted wil look in the default scope and all parent scopes. When specified, only that scope will be queried unless search-parent-scopes is explicitly present. |
wcm:search-parent-scopes |
Set explicitly to |
wcm:always-replace |
If present the body of the element will always be replaced even if the component is not found. The actual (optional) value of this attribute is irrelevant. Default behaviour is to render the original template markup if a component is not found, use this attribute to force empty output instead. |
wcm:auto-create |
If present, the component will be auto-created with the element body as input parameters. Optionally the attribute value can be be the scope name in which the component should be created. If no value is present, the value of wcm:scope will be used to determine the scope in which to create the component. |
wcm:type |
Type key of the |
wcm:parent-create-include |
Relevant only during auto-creation of a possible parent component.
If the parent component is being auto-created nested components would by default be inserted as content markers or added as |
wcm:parse-placeholders |
If present on an element attributed with wcm:component, the body of the element will always be parsed and all sections marked wcm:placeholder will be made available in the |
wcm:placeholder |
Attribute to indicate that a section should be rendered to a placeholder. The name of the placeholder is the value of the attribute. Note that the element itself will also be part of the placeholder content, not just the body of the element. |
wcm:prop:{propertyName} / wcm:property:{propertyName} |
Attribute to set the property of a component. The key contains the name of the property on the component and the value of the attribute will be applied to the property when the component is auto-created. |
wcm:meta:{propertyName} / wcm:metadata:{propertyName} |
Attribute to set a property on the metadata attached to a component. The key contains the name of the property on the metadata attached to the component and the value of the attribute will be applied to the property when the component is auto-created. |
wcm:attr:{attributeName} / wcm:attribute:{attributeName} |
Attribute to register the value to either a property or metadata property on the component. The value of the attribute will be applied to the property when the component is auto-created. If the attribute name matches a property of the component, it will be applied to that property. If not, it will be treated as a metadata property. |
For more details, see the section web components Thymeleaf integration.