Make sure you have the following repository configuration under the repositories section in the root pom.xml
.
<repository>
<id>bloomreach-maven2-forge</id>
<name>Bloomreach Maven 2 Repository</name>
<url>https://maven.bloomreach.com/repository/maven2-forge/</url>
</repository>
In the root pom.xml
, add a version property (see release notes for the latest version):
<properties>
<forge.templating-support.version>4.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-handlebars</artifactId>
<version>${forge.templating-support.version}</version>
</dependency>
In site/src/main/webapp/WEB-INF/web.xml
, add the following:
<servlet>
<servlet-name>handlebars</servlet-name>
<servlet-class>org.onehippo.forge.templating.support.handlebars.servlet.HandlebarsHstTemplateServlet</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>handlebars</servlet-name>
<url-pattern>*.hbs</url-pattern>
</servlet-mapping>
Add *.hbs
in Included Files in webfiles configuration. See https://xmdocumentation.bloomreach.com/library/concepts/web-files/web-files-configuration.html.
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 Handlebars in your project.