When creating a new template, what are the required and optional fields in the `config.` file?

Calendar 👁️ 69

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

  1. **If I am in the `config

Related articles

Where is the root directory of AnQiCMS template located?

As a senior security CMS website operator, I fully understand the core position of templates in website construction and content presentation.The template not only determines the visual style of the website, but also directly affects user experience and the efficiency of content delivery.Accurately understand the storage location of the template file is the basis for carrying out any website customization and optimization work. ### The Root Directory Location of AnqiCMS Templates In the architecture design of AnqiCMS, all the core files of the website templates are stored in a clear root directory.

2025-11-06

How to set up an independent directory structure for the mobile template of AnQiCMS?

As a website operator who is deeply familiar with the operation of AnQiCMS, I know that a flexible and efficient template management mechanism is important for the website, especially in the mobile-first era, providing an independent optimized template experience for mobile devices is the key to attracting and retaining users.AnQiCMS provides powerful support in template design, including setting up a separate directory structure for mobile templates, which allows us to provide customized content display and interactive experience for different devices.

2025-11-06

How to create a responsive, code adaptation, or PC+mobile separation template for the AnQiCMS website?

As a website content expert who deeply understands the operation of AnQiCMS, I know that a high-quality template is crucial for the attractiveness and user retention of the website.AnQiCMS provides great flexibility in template design, supporting various modes to meet different business needs and user access habits.Next, I will elaborate on how to create adaptive, code adaptation, or PC + mobile terminal separation templates for the AnQiCMS website.

2025-11-06

What character encoding format should the AnQiCMS template file follow when editing?

As an experienced website operator who deeply understands the operation of AnQiCMS, I know that the details of content presentation are crucial to user experience.The character encoding of the template file is one of the essential basic links that should not be ignored.Clear and accurately displaying content is the first step to attracting and retaining users. ### AnQiCMS Template File Character Encoding Specification AnQiCMS template files must strictly follow the UTF-8 character encoding format when edited and saved.

2025-11-06

How to configure the display mode of the `template_type` field in `config.`?

As an experienced CMS website operation personnel, I am well aware of the importance of template configuration for website presentation and user experience.Today, let's delve into the `template_type` field in the `config.` file, which finely controls the display mode of your website template.In AnQi CMS, each template package core includes a configuration file named `config.`.This file is the 'identity certificate' of the template, which defines the name, version, author, and other basic information of the template. Among them

2025-11-06

What do the two states represent for the `status` field in `config.`?

In AnQiCMS (AnQiCMS) template management system, the `config.` file plays a crucial role, acting like an ID card for the template, recording all basic information and current status of the template.The `status` field is the key indicator used by the system to identify whether a template is activated and in use.This field has only two possible values, each representing different meanings and uses, which are crucial for the normal operation of the website and the flexible management of templates.### Status 1: `status: 0`

2025-11-06

How does the AnQiCMS template organize common code (such as header and footer)?

As an experienced CMS website operation personnel of an enterprise, I know that efficient content management cannot do without a well-organized and easy-to-maintain template system.In AnQi CMS, to better manage the public code of the website, such as the header (Header) and footer (Footer), the system provides a clear template organization structure and powerful template engine features.This not only improves the development efficiency, but also ensures the consistency and maintainability of website content.

2025-11-06

How to create and reference reusable code snippets (such as sidebars) in AnQiCMS templates?

As an experienced CMS website operation personnel of a security company, I know that efficiency and maintainability are the key to website content management in daily work.AnQiCMS provides a powerful and flexible template system, where creating and referencing reusable code snippets is an important means to improve these aspects of efficiency.This not only reduces repetitive labor, but also ensures the consistency of the overall style and function of the website, and also lays a solid foundation for future content updates and website renovations.

2025-11-06