Link Search Menu Expand Document

Getting started

On this page

  1. Installation
  2. Usage

Installation

A minimum of Java 8 and Thymeleaf 3.x is required. Add the layout dialect by configuring Maven or your Maven-compatible dependency manager to the following co-ordinates:

  • GroupId: nz.net.ultraq.thymeleaf
  • ArtifactId: thymeleaf-layout-dialect
  • Version: 3.2.0

Check the project releases for a list of available versions. Each release page also includes a downloadable JAR if you want to manually add it to your project classpath.

Usage

Configure Thymeleaf to include the layout dialect using one of the methods below:

  • Spring or Spring Boot w/ Java/annotation config:
    @Bean
    public LayoutDialect layoutDialect() {
      return new LayoutDialect();
    }
    
  • DIY management of the Thymeleaf template engine:
    TemplateEngine templateEngine = new TemplateEngine();
    templateEngine.addDialect(new LayoutDialect());
    

This will introduce the layout namespace, and 5 new attribute processors that you can use in your templates: decorate, title-pattern, insert, replace, and fragment.

Continue on to the processors section to learn how to use these in your templates.