Child pages
  • Guide to Site Publisher Templates - The meta.json File
Skip to end of metadata
Go to start of metadata

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.

Important:

Each meta.json file must include the information hash and may include one or more hashes in the fields array. 

Note:

This file does not store user-entered information. The system stores that data in the configuration file for each Site Publisher website.

The information hash

The information hash contains all of the data that cPanel uses for individual Site Publisher templates.

ParameterTypeDescriptionPossible valuesExample
idstring

Required

The template ID. This value is also the template's directory name.

A valid string.my_template
namestring

Required

The 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
datestring

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.

Note:

We introduced this parameter in cPanel & WHM version 62.


A valid date, in YYYY-MM-DD format, where:

  • YYYY represents the four-digit year.
  • MM represents the two-digit month.
  • DD represents the two-digit day.
2017-01-01
descriptionstring

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_pathstring

Required

The path to the template's preview image.

Note:

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.

Important:

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. 

ParameterTypeDescriptionPossible valuesExample
idstring

Required

The field's unique ID.

A valid string.description
labelstring

Required

The 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
typestring

Required

The field type. This value determines the type of form field that cPanel's Site Publisher interface (cPanel >> Home >> Domains >> Site Publisher) displays.

Notes:

  • Older browsers may not support all HTML5 field types. Most older browsers revert to the text or textarea types for field types that they do not support.
  • The way in which some HTML5 field types display depends on the specific browser and its version.

A Site Publisher-supported field type:

  • checkbox — A checkbox.
  • color  — A color value.
  • date — A date.
  • datetime — A date, time, and timezone.
  • datetime-localA date and time.
  • email — An email address.
  • month — A month and year.
  • number — A numeric value.
  • password — A password.
  • range — A numeric value within a range.
  • search — A search field.
  • tel — A telephone number.
  • text — A single-line text box.
  • textarea — A multi-line text box.
  • time — A time.
  • url — A URL.
  • week — A week and year.

For more information, read Mozilla's HTML5 <input> documentation.

text
placeholderstring

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.
minstringThe 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.
  • For the number and range types, a valid integer.
  • For the date, datetime, and datetime-local types, a valid date in YYYY-MM-DD format, where:
    • YYYY represents the four-digit year.
    • MM represents the two-digit month.
    • DD represents the two-digit date.
2012-06-29
maxstringThe 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.
  • For the number and range types, a valid integer.
  • For the date, datetime, and datetime-local types, a valid date in YYYY-MM-DD format, where:
    • YYYY represents the four-digit year.
    • MM represents the two-digit month.
    • DD represents the two-digit date.
2014-03-29
valuestring

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.

Note:

We added this functionality in cPanel & WHM version 60.

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"
  }]
}