In Anqi CMS, creating a new website template is a key step to achieving personalized content display. The core of each template includes aconfig.jsonA configuration file, it is like the "identity card" of a template, declaring basic information, functional characteristics, and management status to the system. Familiarconfig.jsonThe structure and field functions are crucial for website operators and template developers, as they ensure that templates are correctly identified, managed, and applied by the system. This article will provide a detailed analysis of creating new templates, config.jsonThe purpose of each field in the file, and distinguish its importance in practical applications.
Templateconfig.jsonThe location of the file
In the Anqi CMS template system, every set of templates needs to be in/templateThe directory has an independent folder.config.jsonFiles must be placed in the root directory of this template folder, as the configuration entry for the template.
The core configuration field of the template.
Even though technically speaking,config.jsonAll fields in the file are optional. If not filled in, the system will automatically generate default values based on the actual situation.However, for the normal management and functional implementation of the template, the following fields are considered core and highly recommended to be filled out, as they are directly related to the recognition and behavior pattern of the template in the system.
nameThe field is used to define the display name of the template.This is the main basis for users to identify and select templates in the background management interface.A clear and meaningful template name can help operations personnel quickly distinguish and apply different templates.
packageThe field specifies the name of the folder where the template is located, and the system only supports letters and numbers as its value.This field is the key identifier for the system internal template directory.To ensure that the system can accurately locate and load the template, this field should be consistent with the actual template folder name.
template_typethe field defines the adaption type of the template, and the optional values include0(Adaptive),1(Code adaptation) and2(Computer + phone). This field determines how the template responds to visits from different devices. For example, choose2The template includes independent PC and mobile layouts, which need to be created simultaneouslymobileThe catalog supports mobile端templates. Correctly setting the template type is the basis for ensuring a good user experience on multiple devices.
statusThe field indicates the enablement status of the template, the optional values are0Disabled and1In use). The system only allows one template to be used in all installed templates.statusThe value of1This means that only one template can be enabled at a time. This field is used to control which template the current website is using.
Auxiliary information field of the template
In addition to the above core fields,config.jsonIt includes some auxiliary fields, which are mainly used to provide richer template metadata, convenient for management and traceability of template information.These fields are not essential for the operation of the template, but they can significantly enhance the manageability of the template.
versionThe field allows developers to customize the template version number, which is very useful for iterative updates and version management of the template.By a clear version number, operators can clearly understand the current status and update history of the template.
descriptionThe field is used to provide a brief introduction or description of the template's functions. This helps operation personnel quickly understand its features and applicable scenarios.
authorThe field is used to label the developer or designer of the template. This helps to clarify the copyright information and contact details.
homepageThe field can be filled with the website link of the template author, which is convenient for users or administrators to visit the author's homepage for more information or support.
createdThe field records the creation time of the template, and its format should beYYYY-MM-DD HH:MM:SSThis timestamp helps track the creation history of the template.
This is a description about all fields being optional.
Of Security CMSconfig.jsonThe file design is flexible, all fields are marked as optional. This means that even ifconfig.jsonThere are no fields, the template file can still exist.In this case, the system will automatically generate default values for missing fields based on its internal logic.However, to ensure the clear identification, correct behavior, and efficient management of the template, it is strongly recommended that developers and operators fill in the core and auxiliary information fields accurately and completely according to the actual situation of the template.
config.jsonExample structure
The followingconfig.jsonA typical example of a file that shows the structure of all the fields mentioned above:
{
"name": "默认模板",
"package": "default",
"version": "1.0",
"description": "系统默认模板",
"author": "kandaoni.com",
"homepage": "https://www.kandaoni.com",
"created": "2022-05-10 22:29:00",
"template_type": 0,
"status": 0
}
Summary
config.jsonIt is an indispensable part of the AnQi CMS template, providing metadata and configuration information for the template.By carefully filling out these fields, whether it is a template developer or a website operator, they can manage and utilize the template functions of Anqin CMS more efficiently, thereby building a more attractive and functional website.
Frequently Asked Questions
- **If I am in the `config