Content markers
WebCmsModule provides content marker infrastructure to work with special marker snippets inside textual content. Upon rendering, these markers would be processed and the resulting output would be rendered instead.
Sample content markers
Insert component content: @@wcm:component(title,global,false)@@
Insert placeholder content: @@wcm:placeholder(myplaceholder)@@
Two default markers are supported:
-
placeholder content markers indicate placeholder content should be rendered at the marker’s location
-
component content markers indicate a component should be rendered at the marker’s location
A WebCmsContentMarker
consists of 2 parts:
-
a key indicating the type of content marker - the key is required and cannot contain whitespace
-
an optional string of parameters that is supported by that type
In text a content marker is always surrounde by @@
.
-
@@my.marker@@
-
key: my.marker
-
-
@@my.marker(my, params)@@
-
key: my.marker
-
parameter string: my, params
-
The WebCmsContentMarkerService
is the service for working with content markers in general.
Default rendering support is available for Thymeleaf templates, see the WebCmsModule Thymeleaf dialect.
Content markers are supported in all default component types.
Placeholder content markers
A placeholder content marker indicates that placeholder content should be rendered at the marker’s location. The key is wcm:placeholder and the parameter is the name of the placeholder whose content should be rendered.
Example: @@wcm:placeholder(some.placeholder)@@
Component content markers
A component content marker indicates a component should be rendered at the location of the marker. The key is wcm:component and 3 parameters are required:
-
the component name
-
the scope in which to look for the component
-
should parent scopes be searched as well: true/false
Whitespace is not supported in the parameter string.
Examples:
-
@@wcm:component(my.component.name,default,true)@@
-
will search for my.component in the default scope and all parent scopes
-
-
@@wcm:component(my.component.name,global,false)@@
-
will search for my.component in the global scope only (as global is the last scope the parent flag is of no meaning)
-
-
@@wcm:component(my.component.name,container,false)@@
-
will search for my.component in the container members - only relevant in the context of a
ContainerWebCmsComponentModel
being rendered
-
Creating custom content markers
See WebCmsModule Thymeleaf dialect on how to add content marker support for component rendering.