Development Guides Home >> Guide to Site Publisher Templates
Guide to Site Publisher Templates - The meta.json File
Introduction
The meta.json
file stores your Site Publisher template's information. Every Site Publisher template that you create must include a meta.json
file in the main template directory. cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) uses this file to display template information and generate the form fields in the Customize and Publish step.
This file does not store user-entered information. The system stores that data in the configuration file for each Site Publisher website.
-
Each
meta.json
file must include theinformation
hash and may include one or more hashes in thefields
array.
The information hash
The information hash contains all of the data that cPanel uses for individual Site Publisher templates.
Parameter | Type | Description | Possible values | Example |
---|---|---|---|---|
id |
string | RequiredThe template ID. This value is also the template's directory name. | A valid string. | my_template |
name |
string | RequiredThe template's display name. cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) displays this name in the Select a Template section. |
A valid string. | My Template |
date |
string | The template's creation date. cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) uses this value to determine the template's display order in the list of templates.If you do not supply a value, the cPanel interface sorts the template to the end of the template list. |
A valid date, in YYYY-MM-DD format, where:
|
2017-01-01 |
description |
string | Required The template's description. cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) displays this text in the Select a Template section. |
A valid string. | A one-page placeholder website. |
preview_image_path |
string | RequiredThe path to the template's preview image.Preview images must be at least 370 by 200 pixels. The system will automatically shrink larger images. | The path to a preview.png file, relative to the template directory.This file must use the preview filename and the .png file extension. |
img/preview.png |
The fields array
The fields
array includes hashes of data for each custom field that the Customize and Publish section of cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) displays. You can use these variables in the Template Toolkit files in your template in order to allow users to customize the information that their websites display.
Parameter | Type | Description | Possible values | Example |
---|---|---|---|---|
id |
string | RequiredThe field's unique ID. | A valid string. | description |
label |
string | RequiredThe field's label. cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) displays this label with the form field in the Customize and Publish section. | A valid string. | Description |
type |
string | RequiredThe field type. This value determines the type of form field that cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) displays. Note:
|
A Site Publisher-supported field type:
<input> documentation. |
text |
placeholder |
string | The default placeholder value that cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) displays before the user enters a value for the email , number , password , search , tel , text , textarea , and url field types.If you do not supply a value, the interface will not display placeholder text for that input field. |
A valid string. | This site is under construction. |
min |
string | The minimum value that cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) will allow for a value in the date , datetime , datetime-local , number , or range field types. |
|
2012-06-29 |
max |
string | The maximum value that cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) will allow for a value in the date , datetime , datetime-local , number , or range field types. |
|
2014-03-29 |
value |
string | The default value for the checkbox , color , date , datetime , datetime-local , month , range , time or week field types. cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) will preselect this value when it loads the selected template. |
A valid value for the selected field type. | #4acaa8 |
Example
{
"information": {
"id": "my_template",
"name": "My Template",
"date": "2017-01-01",
"description": "A one-page placeholder website.",
"preview_image_path": "img/preview.png"
},
"fields": [{
"id": "text_field",
"label": "A Text Field",
"type": "text",
"placeholder": "This text will appear until the user enters a value."
},
{
"id": "password_field",
"label": "A Password Field",
"type": "password",
"placeholder": "This text will appear until the user enters a value."
},
{
"id": "textarea_field",
"label": "A Large Text Box",
"type": "textarea",
"placeholder": "This text will appear until the user enters a value."
},
{
"id": "checkbox_item",
"label": "Check the checkbox?",
"type": "checkbox"
},
{
"id": "color_field",
"label": "Pick a Color",
"type": "color",
"value": "#4acaa8"
},
{
"id": "date_field",
"label": "Date",
"type": "date",
"min": "2012-06-29",
"max": "2014-03-29"
},
{
"id": "datetime_field",
"label": "Date, Time, and Timezone",
"type": "datetime",
"min": "2012-06-29",
"max": "2014-03-29"
},
{
"id": "datetime-local_field",
"label": "Date and Time",
"type": "datetime-local",
"min": "2012-06-29",
"max": "2014-03-29"
},
{
"id": "email_field",
"label": "Email Address",
"type": "email",
"placeholder": "user@example.com"
},
{
"id": "month_field",
"label": "Month and Year",
"type": "month"
},
{
"id": "number_field",
"label": "A Number",
"type": "number",
"min": "0",
"max": "10"
},
{
"id": "range_field",
"label": "A Range",
"type": "range",
"min": "0",
"max": "10"
},
{
"id": "search_field",
"label": "A Search Box",
"type": "search",
"placeholder": "This text will appear until the user enters a value."
},
{
"id": "tel_field",
"label": "A Telephone Number",
"type": "tel",
"placeholder": "555-555-1212"
},
{
"id": "time_field",
"label": "A Time",
"type": "time"
},
{
"id": "url_field",
"label": "URL",
"type": "url",
"placeholder": "http://www.cpanel.com"
},
{
"id": "week_field",
"label": "A Week and Year",
"type": "week"
}]
}