What are the possible values and their meanings for the `template_type` field in `config.`?

Calendar 👁️ 51

As an experienced CMS website operation person, I fully understand the importance of template configuration for the front-end display and user experience of the website.config.jsonThe file is the core configuration file of each AnQiCMS template, defining the basic properties and behaviors of the template. Among them,template_typeFields play a crucial role, directly affecting the way a website is displayed on different devices.

Now, let's take a detailed look atconfig.jsonintemplate_typethe various optional values of the field and their specific meanings.

AnQiCMS template type overview

In the AnQiCMS template system,template_typeThe field is used to specify how the template handles the display logic for different access devices (such as computers, mobile phones, tablets).This setting is directly related to the user experience, development efficiency, and subsequent maintenance costs of the website.The correct template type selection can help your website better serve your target users and adapt to changing device environments.

template_typefield inconfig.jsonDefined in the file in numeric form, it has three main optional values, each representing a unique template adaptation strategy.

Value: 0 - Adaptive Template Type (Responsive/Adaptive Template Type)

Whentemplate_typeSet to0At this point, it means that your template has adoptedAdaptive designIn this mode, all of your page layouts, styles, and interactions are integrated into a single template code.The website adjusts the layout and size of elements automatically based on the screen size, resolution, and orientation of the device being accessed, using front-end technologies such as CSS media queries (Media Queries), flexible layout (Flexbox), or grid layout (Grid) to ensure that content displays well on all devices.

Choose an adaptive template type, which means you only need to maintain a set of template codes, greatly simplifying content management and update work.It provides a unified access experience for users, regardless of the device they use, they can see the same content structure and design style, but the presentation is different.This pattern is usually favored by search engines because it avoids duplicate content and jump issues, which is beneficial for SEO optimization.

Value: 1 - Code Adaptation Template Type

Whentemplate_typeSet to1This means your template has adoptedCode adaptation design. Unlike adaptive, code adaptation mode, the system will decide which set of template code to send to the user on the server side based on the type of user's device (for example, whether it is a PC or mobile end).This means that the website may have two or more different HTML structures and styles, optimized for different devices.

In AnQiCMS, if you select the code adaptation template type, the system will require you to create a folder named in the root directory of the templatemobilein your template folder. ThismobileThe directory will be used to store template files designed specifically for mobile devices. When the system detects that the user is accessing through a mobile device, it will prioritize the call.mobileFiles in the directory correspond to the corresponding template. The advantage of this model is that you can provide highly customized experiences for different devices without being limited by a set of codes, but it also increases the complexity of template development and maintenance.

Value: 2 - PC + Mobile Independent Template Type

Whentemplate_typeSet to2At that time, this refers toIndependent template mode for computer and mobile terminalThis pattern has a conceptual similarity to code adaptation, in that both are based on providing different templates on the server side according to the device type.However, it clearly emphasizes that the PC and mobile versions are completely independent template sets.

Just like the code adaptation mode, choosing the computer + mobile template type also requires you to create it under the template root directorymobileThe catalog, and place the mobile-specific template within it. This strategy is suitable for those who have completely different design requirements for PC and mobile ends, or who wish to provide a more streamlined and faster loading experience on the mobile end.It allows developers to optimize deeply for each platform, thereby providing an ultimate user experience.From an operational perspective, although development and maintenance costs may be the highest, they can bring the best device adaptation effects, especially when facing specific user groups or scenarios with high performance requirements.

The choice of summary template type

Understandingtemplate_typeThe meaning of each is crucial for website operators of AnQiCMS.It not only determines the route of your website's technical implementation, but also profoundly affects user experience, content management strategy, and SEO performance.Based on your business needs, target user group, and development resources, choosing the appropriate template type will be a key step in building an efficient and user-friendly website.


Frequently Asked Questions (FAQ)

1. I should always choose the adaptive template type (template_type: 0) right?

It is not necessarily so. Although the adaptive template (template_type: 0Due to its feature of "one code, multi-end adaptation", it has a significant advantage in development and maintenance and is favored by search engines, but it is not suitable for all scenarios. If there are significant differences in functionality, layout, or content priority between your PC and mobile end, or if you need to provide extreme performance optimization for the mobile end, then code adaptation or the independent mode of PC + mobile (template_type: 1or2)May be more suitable, as they allow you to provide a highly customized experience across different platforms.Choose the mode based on a comprehensive consideration of user needs, website features, and development and maintenance costs.

2. Code adaptation (template_type: 1) and independent computer + phone mode (template_type: 2) What are the main differences in template design in practice?

In AnQiCMS practice, from the perspective of template design, the core common point of these two modes is that they both require you to create an independentmobileDirectory, and place the mobile version template in it. The main differences are more evident in the concepts and possible subtle implementation differences: code adaptation (template_type: 1) Can be considered a more general server-side adaptation strategy, while the computer + mobile independent mode (template_type: 2) emphasizes more clearly designing two separate sets for PC and MobileTotally independenttemplate, pursuing performance on both platforms. This means thattemplate_type: 2Below, you may prefer to completely decouple the PC and Mobile templates in terms of structure, style, and even part of the content to achieve deeper customization and optimization.

3. If I chosetemplate_type: 1or2where should my mobile template file be located?

No matter which you choosetemplate_type: 1(code adaptation) ortemplate_type: 2(Computer + Phone Independent Mode), AnQiCMS requires you to create a file namedmobileThe subdirectory. All template files specifically designed for mobile devices (such asmobile/index/index.html/mobile/{模型table}/detail.html), should be stored in thismobileIn the directory, and maintain a file structure similar to that of the PC template so that the system can correctly match and call it.

Related articles

How to define a new template, what is the role of the `config.` file?

As an experienced CMS website operation personnel, I am well aware that a flexible and efficient template system is crucial for the presentation of website content and user experience.The AnQi CMS was designed with full consideration of the customizability and ease of use of the templates, allowing both beginners and experienced developers to easily handle it.Next, I will elaborate on how to define a new template in Anqi CMS and deeply analyze the core role played by the `config.` file in this process.

2025-11-06

How to create and apply an independent template for a specific single page (such as 'About Us')?

As an experienced website operator who deeply understands the operation of AnQiCMS, I understand that you want to create and apply an independent template for a specific single page (such as "About Us").This not only allows the page content to be displayed more personalized, but also effectively meets specific design and functional requirements.AnQiCMS provides a flexible template mechanism, making this process intuitive and efficient.### A detailed guide to creating and applying independent templates for specific single pages in AnQiCMS AnQiCMS is known for its high customizability and flexibility

2025-11-06

How to customize the document list template for a specific category?

As a website operator who deeply understands the operation of AnQiCMS, I understand your needs for personalized content display and user experience optimization.The document list template under the custom category is the key step to achieve this goal.AnQiCMS provides a flexible template mechanism that allows you to present a unique list layout based on the content features of specific categories.

2025-11-06

What are the naming conventions to follow for a specific document detail page template?

As an experienced security CMS website operations personnel, I deeply understand the importance of the naming rules of the content management system (CMS) template for the long-term operation, maintenance efficiency, and content presentation quality of the website.A clear and standardized template naming not only allows team members to quickly understand the purpose of the file, reduce collaboration costs, but also provides strong flexibility and scalability when the website faces a redesign or feature upgrade.In AnQi CMS, the naming of templates for specific document detail pages follows a set of flexible and hierarchical rules, aimed at meeting the needs of content display at different granularity.

2025-11-06

How to control the enable status of the template through the `status` field in `config.`?

In the daily operation of Anqi CMS, we often need to adjust the appearance and layout of the website, which usually involves switching or enabling different templates.AnQi CMS provides an intuitive and efficient way to manage the enabled status of templates, which is mainly achieved through the `status` field in the `config.` file under each template directory.

2025-11-06

How should common code snippets like headers, footers, etc. be organized and stored during template creation?

As a website operator familiar with Anqi CMS, I am well aware of the importance of a well-structured and easy-to-maintain template for the long-term healthy operation of the website.How to efficiently organize and store common page headers, footers, and other reusable code snippets during template creation is crucial for improving development efficiency and ensuring website consistency.In Anqi CMS, the template system uses a syntax similar to the Django template engine, which provides us with powerful tools to achieve code reuse and modular management.

2025-11-06

How to create and reference reusable code snippets like sidebars, breadcrumbs, etc. in templates?

As an experienced CMS website operation person in a security company, I am well aware of the importance of efficient content management and flexible template customization for website operation.In daily work, we often need to deal with various page elements, such as sidebars, breadcrumb navigation, headers, and footers, etc., which appear repeatedly on multiple pages.It is crucial to modularize and reuse these commonly used code snippets in order to improve development efficiency, ensure code consistency, and simplify maintenance work.AnQi CMS provides a powerful and easy-to-use template engine, allowing us to easily achieve this goal.

2025-11-06

What should the default naming of the homepage template file be?

As an experienced CMS website operation personnel, I fully understand the importance of the homepage in attracting and retaining users. It is the first impression of users visiting the website and also the core hub of content layout and information communication.For Anqi CMS, understanding the naming conventions of its template files, especially the default naming of the homepage template file, is the foundation for ensuring the smooth operation and efficient management of the website.The Anqi CMS system defaults to identifying the homepage template file as `index.html`.This file is the entry point of your current theme template

2025-11-06