This module provides the builtin
layout taglib for Marko. The
layout taglib provides support for separating out an HTML layout from content. A layout a just a normal Marko template with placeholders that allow for additional content to be provided by another template.
Example usage of of the
layout taglib is shown in the sample code below:
<!doctype html>Default Footer
My PageBODY CONTENT
A layout is just a standard Marko template with special
<layout-placeholder> tag should be assigned a name using the
Each placeholder can have default content that is shown if no content for the placeholder is provided by the caller. The default content (if any) should be provided as nested content as shown below:
This is the default content for the "footer" placeholder. Ifno "footer" content is provided by the caller then this content willbe rendered.
The user of a layout template can provide content for a placeholder using the
<layout-put> tag (described later).
<layout-use> tag is used to render a layout template with content being provided by the caller.
<layout-put> tag is used to provide layout content.
If nested content is provided then it will be used the content for the corresponding placeholder.
Alternatively, the content can be provided using the
value attribute as shown below:
Additional data can be provided to a layout template by the caller. Data is separate from content and be used to control how the layout renders. Layout data will be accessible as properties in the standard
data variable. Any additional attributes other than the "template" attribute that are provided to the
<layout-use> tag are used to pass additional data to a layout template.
The example below shows a
showHeader option can be passed to a layout template to control how the header content renders:
NOTE: All data attributes will be de-hyphenated and converted to camel case (e.g.,
show-header will be accessible via the
showHeader property on the