Fork me on GitHub

Install Thymeleaf Templating Support Module

Bloomreach Forge Maven Repository

Make sure you have the following repository configuration under the repositories section in the root pom.xml.

    <repository>
      <id>hippo-maven2-forge</id>
      <name>Hippo Maven 2 Repository</name>
      <url>https://maven.onehippo.com/maven2-forge/</url>
    </repository>

Adding Dependencies

In the root pom.xml, add a version property (see release notes for the latest version):

    <properties>
      <forge.templating-support.version>2.0.0</forge.templating-support.version>
    </properties>

For a project on 13, add the following dependency in cms-dependencies/pom.xml, :

    <dependency>
      <groupId>org.onehippo.forge.templating-support</groupId>
      <artifactId>templating-support-core-platform</artifactId>
      <version>${forge.templating-support.version}</version>
    </dependency>

Add the following dependency in site/pom.xml:

    <dependency>
      <groupId>org.onehippo.forge.templating-support</groupId>
      <artifactId>templating-support-thymeleaf</artifactId>
      <version>${forge.templating-support.version}</version>
    </dependency>

Adding Servlet Configuration

In site/src/main/webapp/WEB-INF/web.xml, add the following:

  <servlet>
    <servlet-name>thymeleaf</servlet-name>
    <servlet-class>org.onehippo.forge.templating.support.thymeleaf.servlet.ThymeleafHstTemplateServlet</servlet-class>
    <init-param>
      <param-name>cache.enabled</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>200</load-on-startup>
  </servlet>

  <-- SNIP -->

  <servlet-mapping>
    <servlet-name>thymeleaf</servlet-name>
    <url-pattern>*.html</url-pattern>
  </servlet-mapping>

Configure WebFiles to Include .html File Extension

Add *.html in Included Files in webfiles configuration. See https://www.onehippo.org/library/concepts/web-files/web-files-configuration.html.

Switch Template Support

By default, the Switch Template Support feature in the product supports only FreeMarker templates. Follow the instruction in the Switch Template Support section to enable the feature for Thymeleaf in your project.