Introduction
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.
Template files
Site Publisher templates should include the following files, as well as additional style- and design-related files:
File name |
Type |
Description |
meta.json |
JSON |
Every Site Publisher template that you create must include a meta.json file in the main template directory. cPanel's Site Publisher interface (Home >> Domains >> Site Publisher) uses this file to display template information and generate the form fields in the Customize and Publish step. |
*.tt |
Template Toolkit |
The template's .tt files include the variables from the meta.json file in Template Toolkit markup. This file can use many different types of code (for example, JavaScript, CSS, or HTML). 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 .html.tt file in the template will become a .html file in the published website. |
preview.png |
PNG |
The preview image that cPanel's Site Publisher interface (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. Notes:
|
LICENSE |
Text |
The template's license information. The system includes this file with the published website. Note: For cPanel-provided templates, the license information ships in the/usr/local/cpanel/3rdparty/share/template/copyright file, where template represents the template name. |
README.md |
Text |
The template's README file. The system does not include this file with the published website. |
Example
For example, you could create a template for a simple placeholder website that includes a website title, website description, and a contact email address.
Files
This template would include the following files:
meta.json
This file supplies the template's data, and ensures that cPanel's Site Publisher interface (Home >> Domains >> Site Publisher) displays theWebsite Title (site_title
), Website Description (description
), and Contact Email Address (email
) text boxes.
index.html.tt
index.html.tt
This file uses the site_title
, description
, and email
variables in Template Toolkit code to add user-supplied content to the page. When the system uses this file to generate the index.html
file for each Site Publisher website, it will replace the Template Toolkit code with user-supplied content.
preview.png
This image will display in the Select a Template section of cPanel's Site Publisher interface (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 (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:
1
2
3
|
[% IF fullName.length %] < h1 >[% fullName | html %]</ h1 > [% END %] |
This code will display the user-provided fullName
value if the value contains one or more characters.