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.