Although you can deploy a layout template by itself, you can also bundle it with a theme. To include a layout template with a theme, follow these steps:
-
Open your theme’s
liferay-look-and-feel.xml
file, and nest<layout-templates>
tags in between the<theme>...</theme>
tags so it matches the configuration below:<theme id="my-theme-name" name="My Theme Name"> ... <layout-templates> <custom> //layout template code goes here </custom> </layout-templates> ... </theme>
-
Place the layout template in between the
<custom>...</custom>
tags, using the<layout-template>
tag. The<layout-template>
tag’sid
attribute must match the layout template’s filename. Below is an example configuration:<layout-template id="my_liferay_layout_template" name="My Liferay Layout Template">
-
Specify the layout template’s path with a
<template-path>
tag, as shown below:<template-path> /layoutttpl/custom/my_liferay_layout_template.ftl </template-path>
-
Specify the layout template thumbnail’s path with a
<thumbnail-path>
tag, as shown below:<thumbnail-path> /layoutttpl/custom/my_liferay_layout_template.png </thumbnail-path>
-
Place the completed layout in your theme’s
src/layouttpl
folder. Below is an exampleliferay-look-and-feel
configuration:<theme id="my-theme-name" name="My Theme Name"> ... <layout-templates> <custom> <layout-template id="my_liferay_layout_template" name="My Liferay Layout Template"> <template-path> /layoutttpl/custom/my_liferay_layout_template.ftl </template-path> <thumbnail-path> /layoutttpl/custom/my_liferay_layout_template.png </thumbnail-path> </layout-template> </custom> </layout-templates> ... </theme>
Now you know how to include layout templates with your Liferay DXP themes!
Related topics
Creating Custom Layout Template Thumbnail Previews