How to define an AnQiCMS template configuration file (config.)?

Calendar 👁️ 66

As an experienced website operations expert, I fully understand the importance of a flexible and powerful content management system for enterprises.AnQiCMS is a top-notch platform committed to providing efficient and customizable solutions.config.jsonIt plays a crucial role. It not only defines the basic attributes of the template but also profoundly affects the behavior and performance of the template in the system.

AnQiCMS template's "Identity Certificate":config.jsonParsing

Under the AnQiCMS template root directory, you will find a file namedconfig.jsonThe file.It is like the 'ID card' or 'instructions' of a template, through which the system identifies the template, understands its basic properties, and decides how to load and manage this template.config.jsonIt is the basis to ensure that the template can be recognized and run normally by the AnQiCMS system, and it is also the first step to achieve high customizability of the template.

Let's take a typicalconfig.jsonFor example, interpret the meaning and function of each field one by one in the file content:

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

Firstly, it is the metadata information of the template:

  • nameThis field defines the name displayed in the AnQiCMS admin interface, which is the most intuitive identifier.For example, you can name it "corporate website template" or "fashion blog theme" and so on, which is convenient for quick distinction among many templates.
  • package: Followed by the next one:packageThe field is more critical, as it represents the unique identifier of the template, usuallyit should be consistent with the name of the template folderFor example, if your template folder is calledmythemethenpackagethen you should fill inmythemeThis field only supports letters and numbers, please ensure its accuracy, as the system relies on it to locate template resources, and if it does not match, the template will not be recognized and used.
  • version: Used to record the template version.This is very helpful for iterative updates of templates and issue tracking, especially when engaging in secondary development or collaboration with others, clear version information can avoid a lot of confusion.
  • description: Provided a brief introduction to the template, allowing users to quickly understand the functions and features of the template. This content will be displayed in the background template management list, helping operators to make choices.
  • author,homepage,createdThese three fields, as the names suggest, are used to record the developer of the template, the developer's website, and the creation time of the template.This information not only reflects the developer's right of attribution, but also provides users with the convenience of contact and traceability.

In addition to this basic information,config.jsonit also includes the core configuration that determines the template behavior:

  • template_type: This is a very important setting, which determines how the template responds to user access from different devices. AnQiCMS provides three optional values:
    • 0(Adaptive)This means that the same HTML/CSS/JS code will automatically adjust the layout according to the screen size of the device being accessed.This is the mainstream responsive design method at present, development is relatively centralized.
    • 1(Code Adaptation)In this mode, you may need to prepare different CSS or JS logic for the PC and mobile ends, but still use the same template file (for example, by loading different style sheets based on the user agent).It is between adaptive and completely independent.
    • 2(PC + Independent Mobile)This is the most explicit separation mode, which requires you to create completely independent template directories for the PC and mobile ends. Typically, the mobile template is stored in the root directory of the template.mobileIn the subdirectory.The system will load the corresponding template based on the device type, which is very useful when it is necessary to provide completely different experiences for different devices. Choose the type, which directly affects the complexity of template development and the ultimate user experience, and determines the organization of your template files.
  • status: This field indicates whether the template is enabled:0Indicates that the template is not enabled,1The template is in use. It should be noted that in the AnQiCMS system, only one template can be used at any timestatusThe value of1That is, only one template can be enabled at a time. This is the core mechanism of the system for template switching and management.

In practice,

Related articles

Where should the AnQiCMS template files be placed?

## Unveiling the Home of AnQiCMS Templates: Clear Guidance Helps You Customize Easily As an experienced website operations expert, I am well aware of the importance of a flexible and efficient content management system for businesses.AnQiCMS is an excellent platform developed based on the Go language, which not only wins the favor of many users with its high performance and high concurrency features, but also provides great convenience in customization.For operators and developers who want to fully utilize their customization potential and build personalized websites, clearly defining the storage directory of AnQiCMS template files is the first step towards success.

2025-11-07

How to generate random text for testing in the AnQiCMS template?

As an experienced website operations expert, I am well aware that during the website development and content testing stage, it is often difficult to cook without the necessary ingredients - lacking real content to fill the page, in order to verify design, layout and function.Especially for operators and developers who use powerful and flexible content management systems like AnQiCMS (AnQiCMS), efficiently simulating content is the key to improving work efficiency.

2025-11-07

How to define and use variables (set, with) in AnQiCMS templates?

Mastery in AnQiCMS templates: Unlocking the Power of Variables (Deep Analysis of set and with) As an experienced website operations expert, I know that a flexible and efficient content management system is crucial for the success of a website.AnQiCMS with its concise and efficient architecture and support for Django template engine syntax, provides us with great convenience.In template development, being proficient in variable definition and assignment is undoubtedly the key to enhancing template flexibility and maintainability.

2025-11-07

How to format timestamp display in AnQiCMS template?

As an experienced website operation expert, I am well aware that the timeliness and presentation of content are crucial to user experience.In an efficient content management system like AnQiCMS, even a seemingly simple date display contains operational wisdom to enhance the professionalism and readability of the website.Today, let's delve into how to beautifully transform the original timestamps into user-friendly date formats in the AnQiCMS template.

2025-11-07

How does the AnQiCMS template support adaptive, code adaptation, and PC+mobile mode?

## AnQiCMS template: How to ride the multi-end content display with wisdom and flexibility?In today's fast-paced digital world, it is common for users to access websites through various devices.As experienced website operators, we know that whether a website can provide a smooth and high-quality experience on PCs, tablets, mobile phones, and other terminals is directly related to user retention and business conversion.

2025-11-07

How to set a custom template for the document detail page or category list page of AnQiCMS?

As an experienced website operations expert, I am well aware that the flexibility and customizability of a content management system (CMS) are crucial for the long-term development of the website and the user experience.AnQiCMS (AnQiCMS) provides an excellent solution in this aspect with its powerful functions and ease of use.Today, let's delve into how to set up custom templates for your document detail page or category list page in AnQiCMS, making your website content display more personalized and professional.

2025-11-07

How does the AnQiCMS template handle the escaping and unescaping of HTML content?

As an experienced website operations expert, I am well aware of the subtle balance between content safety and flexible display.In AnQiCMS such an efficient and secure content management system, understanding how its templates handle the escaping and unescaping of HTML content is crucial for building both aesthetically pleasing and secure user experiences.AnQiCMS is developed based on Go language, its template engine inherits many safety design concepts of modern web frameworks when processing HTML, including automatic escaping of HTML content.

2025-11-07

How to extract a specified part of a string or list in the AnQiCMS template?

In the daily operation of Anqi CMS, we often encounter scenarios where we need to display content in a refined manner.How to flexibly extract the part we want from a string or list, whether it is an article summary, product parameter list, or a user comment excerpt, is the key to improving user experience and page cleanliness.As an experienced website operation expert, I deeply understand the strength and flexibility of AnQiCMS based on Go language and Django template engine. Today, let's delve into how to accurately extract the specified part of a string or list in the AnQiCMS template.###

2025-11-07