A WebJET template defines the visual shell of a web page: its layout, the CSS and JavaScript it loads, and which include pages provide the header, footer, and menu. This guide walks through creating a template from scratch and configuring the supporting tools.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/webjetcms/webjetcms/llms.txt
Use this file to discover all available pages before exploring further.
What a template is
In WebJET CMS a template has two parts:- An HTML/JSP file on disk — the physical layout file stored under
/templates/. It contains the full HTML structure and usesdata-th-*/data-iwcm-*attributes to inject dynamic content. - A template record in the admin area — created under Templates → Template List. It links the HTML file to CSS styles, include pages (header, footer, menu), and editor settings.
Creating a new template file
Start from the Ninja Starter Kit or copy an existing template. A minimal Thymeleaf-based template looks like this:Required template variables
The objects below are injected by WebJET when a page is rendered and are available in every template.Page data (docDetails / data-iwcm-write)
| Write attribute | Description |
|---|---|
doc_data | The body text of the page as entered in the editor |
doc_title | Page title |
doc_head | HTML from the header include page defined in the template |
doc_foot | HTML from the footer include page |
doc_menu | HTML of the navigation menu |
doc_right_menu | HTML of the right-side menu |
navbar | Breadcrumb navigation bar |
html_head | Additional HTML code entered for this page in the Advanced tab |
group_htmlhead_recursive | HTML head code from the folder, inherited from parent folders |
base_css_link | Link to the main CSS file set in the template record |
css_link | Link to the secondary CSS file |
field_a … field_l | Custom fields for the page (see Custom fields) |
Ninja template objects
Access these via Thymeleaf expressions (${ninja.xxx}):
Thymeleaf attribute patterns
WebJET always uses thedata-th- prefix so templates remain valid HTML:
data-th-utext (instead of data-th-text) when the value contains HTML that must not be escaped.
Including CSS and JavaScript
Via data-iwcm-combine
The recommended approach bundles all CSS and JS files into combined requests:
basePathsets the root path prepended to each filename (except paths already starting with/templates/or/components/).- Including
${ninja.webjet.pageFunctionsPath}indata-iwcm-combinetells WebJET that jQuery is already bundled inninja.min.js, preventing a duplicate injection. - A
?v=cache-busting parameter is added automatically.
Direct <link> / <script> tags
For files that should not be combined (e.g. a third-party CDN script), use standard tags with data-th-src or data-th-href for dynamic paths:
Editor-only CSS
The admin page editor automatically loads/templates/TEMPLATE_NAME/dist/css/editor.css. Use this file to override styles that only apply inside the editor without affecting the live site.
Thymeleaf features specific to WebJET
data-iwcm-write and data-iwcm-remove
The data-iwcm-write attribute injects content from WebJET into the element. The wrapping element is preserved or removed based on:
- Attribute name starts with
doc_→ wrapper preserved (unlessdata-iwcm-remove="tag"is set) - Attribute name does not start with
doc_→ wrapper removed by default
Inserting scripts from the scripts application
Inserting the version parameter
WebJET initialisesversion to a timestamp that changes when all caches are cleared. Use it to force reloads of versioned files:
Calling static Java methods
Unique ID placeholder
Use__ID__ in blocks where a unique element ID is required. It is replaced with a random timestamp value when the block is inserted:
CKEditor configuration
WebJET uses a customised CKEditor 4 for page text editing. The following configuration variables control its behaviour.Toolbar
Setckeditor_toolbar (JSON array) to define the toolbar items shown in the website editor. Use ckeditor_removeButtons (comma-separated list) to hide individual buttons without rewriting the entire toolbar definition.
Tables
| Variable | Default | Description |
|---|---|---|
ckeditor_table_class | table table-sm tabulkaStandard | Default CSS class for tables |
ckeditor_table_cols | 5 | Default number of columns |
ckeditor_table_rows | 2 | Default number of rows |
ckeditor_table_width | 100% | Default table width |
ckeditor_table_wrapper_class | table-responsive | CSS wrapper class; empty = no wrapper |
PICTURE element
To enable the<picture> element for responsive images, add WebjetPicture to ckeditor_toolbar. Configure breakpoints via ckeditor_pictureDialogBreakpoints:
"fallback": true is also inserted as a standard <img> for browsers that do not support <picture>.
SVG icons
Setckeditor_svgIcon_path to the path of an SVG sprite file to enable SVG icon insertion. The sprite must contain <symbol> elements with id attributes:
| Variable | Description |
|---|---|
ckeditor_svgIcon_icons | JSON object defining icon groups; if empty, IDs from the SVG file are used |
ckeditor_svgIcon_width | Icon width in pixels |
ckeditor_svgIcon_height | Icon height in pixels |
ckeditor_svgIcon_sizes | Comma-separated size names, e.g. small,medium,large |
ckeditor_svgIcon_colors | Comma-separated colour names, e.g. info,success,warning |
Custom button
To enable a CTA button element, addWebjetFormButton to ckeditor_toolbar (or it appears automatically when SVG icons are configured). Customise with:
| Variable | Default | Description |
|---|---|---|
ckeditor_button_baseClass | btn | Base CSS class |
ckeditor_button_sizes | btn-lg,btn-sm | Available size classes |
ckeditor_button_types | btn-primary,btn-secondary,... | Available type/colour classes |
ckeditor_button_attrs | data-bs-toggle,... | Configurable HTML attributes |
Custom plugins
Place your plugin files insrc/main/webapp/admin/skins/webjet8/ckeditor/dist/plugins/. Register them via ckeditor_extraPlugins (comma-separated) and add button names to ckeditor_toolbar.
Thumbnail servlet for responsive images
WebJET can generate resized images on demand from any file in/images, /files, /shared, /video, or /templates. Prefix the image URL with /thumb and append w and h parameters:
ip (interest point) parameter:
placeholder or stock is clicked in the editor, the image picker opens in the page’s Media folder rather than the folder of the placeholder image, making it easy for editors to upload a real image.
Custom fields for pages
Custom fields let template authors expose additional per-page attributes to content editors. They appear in the web page editor under the Custom Fields tab and map tofield_a through field_t (pages) or group_field_a through group_field_d (folders).
Access the value in a template:
Configuring field types
Field types are set via translation keys in the configuration. The key format iseditor.field_x.type (for the default language):
Text and textarea
Text and textarea
Selection fields
Selection fields
Other types
Other types
| Type value | Field behaviour |
|---|---|
boolean | Checkbox |
number | Numeric input |
date | Date picker |
image | Image picker dialog |
link | File or page link picker |
json_group / json_group_null | Web page folder selector |
json_doc / json_doc_null | Web page selector |
dir | File system folder selector |
color | Colour picker with opacity |
uuid | Auto-generated unique identifier |
enumeration_X | Selection from codebook type X |
none | Hidden — field not shown |
temp-ID. prefix:
