As a senior security CMS website operation person, I am fully aware of the importance of template configuration for the front-end display of the website and the user experience.config.jsonThe file is the core configuration file of each AnQiCMS template, it defines the basic properties and behaviors of the template. Among them,template_typeFields play a crucial role, directly affecting how the website is displayed on different devices.

Now, let's delve into it in detail.config.jsonintemplate_typeThe various optional values of the field and their specific meanings.

AnQiCMS template type overview

In the template system of AnQiCMS,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 directly relates 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 constantly changing device environments.

template_typeis inconfig.jsonDefined in the file as a number, it has three main optional values, each representing a unique template adaptation strategy.

值:0 - English Template Type (Responsive/Adaptive Template Type)

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

Selecting an auto template type means that you only need to maintain a set of template codes, which greatly simplifies the work of content management and updates.It provides a unified access experience for users, regardless of which device they use, they can see the same content structure and design style, just with different presentation methods.This pattern is also often favored by search engines, as it avoids duplicate content and jump issues, which is beneficial for SEO optimization.

值:1 - 代码适配模板类型 (Code Adaptation Template Type)

Whentemplate_typeis set to1时,这代表您的模板采用了 EnglishCode Adaptation Design.Different from auto-adapt, in code adaptation mode, the system will decide which set of template code to send to the user based on the type of the user's device (such as determining whether it is a PC or mobile end) on the server side.This means that the website may have two or more different sets of HTML structures and styles, optimized for different devices.

In AnQiCMS, if you have selected the code adaptation template type, the system will require you to create a file namedmobileThis is a subdirectory. ThismobileThe catalog is used to store template files specifically designed for mobile devices. When the system detects that the user is accessing through a mobile device, it will prioritize callingmobileThe corresponding template file under the directory.The advantage of this pattern is that you can provide a highly customized experience for different devices without being limited to a single codebase, but it also increases the complexity of template development and maintenance.

值:2 - 电脑+手机模板类型 (PC + Mobile Independent Template Type)

Whentemplate_typeis set to2This refers toIndependent template mode for desktop and mobile.This pattern has similarities in concept with code adaptation, that is, both provide different templates on the server side based on the device type.However, it explicitly emphasizes that the PC and mobile端 are completely independent two template sets.

Just like the code adaptation mode, when choosing the desktop + mobile template type, you also need to create it under the template root directorymobileDirectory, and place the mobile-specific template inside.This strategy is suitable for those who have completely different design requirements for PC and mobile terminals, or who wish to provide a more streamlined and faster loading experience on mobile devices.It allows developers to perform deep optimization 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 in scenarios facing specific user groups or high-performance requirements.

Summary template type selection

Understandingtemplate_typeThe meaning of each one is crucial for the website operators of AnQiCMS.It not only determines the technical implementation path of your website, but also has a profound impact on user experience, content management strategy, and SEO performance.According to your business needs, target user group, and development resources, reasonably choosing the template type will be a key step in creating an efficient and user-friendly website.


Common Questions (FAQ)

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

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

2. 代码适配(English)template_type: 1)和电脑+手机独立模式(English)template_type: 2)在实际模板设计时有什么主要区别?(English)

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 independent for the mobile endmobileContents, and place the mobile template inside it. The main differences are more evident in concepts and potential subtle implementation variations: code adaptation (template_type: 1It can be considered a more general server-side adaptation strategy, while the computer+mobile independent modetemplate_type: 2emphasizes the design of two separate sets for PC and Mobile more explicitlyFully independentEnglish template, pursuing performance on both platforms.template_type: 2Below, you might be more inclined to decouple the PC and Mobile templates in structure, style, and even some content to achieve deeper customization and optimization.

3. If I selectedtemplate_type: 1or2Where should my mobile template file be placed?

No matter your choicetemplate_type: 1(Code Adaptation) ortemplate_type: 2(Computer+phone independent mode),AnQiCMS all require you to create a folder namedmobileThe subdirectory. All template files specifically designed for mobile devices (such asmobile/index/index.html/mobile/{模型table}/detail.htmletc.), should be stored in thismobileIn the directory, and maintain a file structure similar to that of the PC end template so that the system can correctly match and call it.