This document provides basic information about the files that most templates include. The additional files that you include in each Site Publisher template (for example, fonts, images, or CSS files) depend on the specifics of your design.
Site Publisher templates should include the following files, as well as additional style- and design-related files, license files, or
readme files that you wish to include:
Every Site Publisher template that you create must include a
For more information, read our Guide to Site Publisher Templates - The meta.json File documentation.
When users publish a site with this template, the system replaces these variables with the user's input, and creates a static file that will exist in the domain's home directory. For example, a
The preview image that cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) displays for each template in the Select a Template step, and for the selected template in the Customize and Publish step.
For example, you could create a template for a simple placeholder website that includes a website title, website description, and a contact email address.
In the cPanel interface
When users select this template in cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher), they will see the following template information:
This template would include the following files:
This file supplies the template's data, and ensures that cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) displays the Website Title (
site_title), Website Description (
description), and Contact Email Address (
This file uses the
index.html file for each Site Publisher website, it replaces the Template Toolkit code with user-supplied content.
This image will display in the Select a Template section of cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher), and in the Customize and Publish step when the user selects this template.
Checks for provided values
If you wish to check whether a user provided a value, we strongly recommend that you use a
.length check within your template file. A
.defined check will not return the desired result because cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) stores blank values rather than undefined values.
For example, to check whether a user supplied a value for the
fullName variable, include the following code in your Template Toolkit file:
This code will display the user-provided
fullName value if the value contains one or more characters.
We introduced this functionality in cPanel & WHM version 62.
To ensure that your template code receives JSON-safe values, you must specify the
json type for those variables.
For example, if you wish to include the user-provided value for the
Lines 3 and 4 of this example illustrate two different methods to apply the
json type to the variable. Your template code may use either method.