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

Calendar 👁️ 63

As an experienced AnQi CMS website operations personnel, I fully understand the importance of template configuration for website presentation and user experience. Today, let's delve deeper into this topic.config.jsonin the filetemplate_typeField, how it finely controls the display mode of your website template.

In AnQi CMS, the core of each template package includes a namedconfig.jsonThe configuration file. This file is the "identity proof" of the template, defining the name, version, author, and other basic information of the template. Among them,template_typeThe field plays a crucial role, determining how your website responds to visits from different devices, thus providing the most suitable browsing experience for PC and mobile users.

The Anqi CMS provides three main template display modes, which are throughtemplate_typeConfigure the different values. Understanding these patterns and their applicable scenarios is the key to ensuring the efficient display of website content and optimizing user experience.

Adaptive mode:template_type: 0

Whentemplate_typeSet to0When, the template will adopt the 'adaptive' display mode.This means that the website will use the same set of HTML code and CSS styles, adjusting the layout and content automatically through responsive design techniques (such as media queries) to fit the screen size of the accessing device.No matter whether on PC, tablet or mobile phone, users will see the same content under the same URL, but the page will be optimized for the device characteristics.

The advantage of this model is that the maintenance cost is low, you only need to manage a set of template codes.For websites with relatively simple content structures, fast deployment, and a desire for a unified experience, adaptive mode is an efficient and practical choice.It simplifies the content publishing process because you do not need to create or adjust independent content versions for different devices.

Code adaptation mode:template_type: 1

Selecttemplate_type: 1Enable the 'Code Adaptation' mode, which allows you to achieve more flexible device adaptability within a single template package.In this mode, AnQi CMS can load specific code snippets or styles from templates based on the type of device accessing (such as through the user agent string).mobileDirectory, and place the local template files or style rules for mobile devices exclusively.

Code adaptation mode provides a balance for users who want to offer differentiated experiences on different devices but do not want to completely separate the PC and mobile site.For example, you can design a lighter navigation menu for mobile devices or optimize the image loading strategy, while keeping the rich features and complex layout of the PC end.This to some extent improves the performance and experience of mobile devices, while avoiding the high maintenance costs of completely independent sites.

Computer + mobile phone independent site mode:template_type: 2

If your website needs to provide a completely independent and highly customized experience for both PC and mobile devices, then you willtemplate_typeis set to2It is an ideal choice to turn on the "Computer+Phone Independent Site" mode.In this mode, AnQi CMS will differentiate between PC and mobile users' visits, and may redirect mobile users to the independent "mobile end address" configured through the "global feature settings".Each site has its own independent template directory and content presentation logic.

The independent site mode grants website operators the greatest degree of design freedom, allowing for the creation of extremely optimized user interfaces and interaction processes for both PC and mobile devices.This is especially important for businesses whose content or features vary greatly across different devices, or require deep SEO optimization for specific devices.However, the maintenance cost of this model is also the highest, as it essentially requires you to manage and update two almost independent sets of website content and templates.

Understandingtemplate_typeThe different configurations and the mechanisms provided by the security CMS can help you make wise template choices according to your actual operating needs.Whether it is to pursue simplicity in maintenance or the ultimate device experience, AnQi CMS provides flexible solutions.


Frequently Asked Questions (FAQ)

1. How to activate or switch the template display mode of the website?To activate or switch the display mode of the template, you need to find it in the corresponding template folderconfig.jsonfile. Modify the followingtemplate_typeThe field is the required value (0, 1, or 2). At the same time, ensure that theconfig.jsonin the filestatusfield to1(in use), and all other templatesstatusfields are0(Disabled), because only one template can be in use at a time. After saving the file, Anqi CMS will automatically recognize the new configuration and apply it.

2. If you selected code adaptation or standalone site mode but did not createmobileWhat will the catalog be like?If yourtemplate_typeConfigured as1Or (code adaptation)2(Computer + mobile standalone site), but the template folder does not includemobileDirectory, the system may encounter problems when trying to load a template for mobile devices.The specific behavior depends on the template design and the system's default error-tolerance mechanism.In most cases, it may revert to the PC template display, which may lead to poor user experience on mobile devices, chaotic page layout, or missing features.mobileDirectory.

3.template_typeCan the field be modified at any time? What should be noted after modification? template_typeThe field can be modified at any time, but a comprehensive test must be carried out after the modification. Especially when switching from adaptive mode to code adaptation or independent site mode, since it involves the loading logic of mobile-specific templates, you need to ensuremobileThe directory and its internal template files have been set up correctly, and the "Mobile End Address" in the "Global Function Settings" (if in independent site mode) has also been properly configured.Any mode switch may affect the website's SEO performance and user experience, therefore it is recommended to perform thorough testing in a non-production environment and back up the website data and files before going live.

Related articles

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

In Anqi CMS, creating a new website template is a key step to achieving personalized content display.The core of each template includes a `config.` configuration file, which is like the template's 'ID card', declaring the basic information, functional characteristics, and management status to the system.Familiarize yourself with the structure and field functions of the `config.` file, which is crucial for website operators and template developers, as it ensures that the template is correctly identified, managed, and applied by the system.

2025-11-06

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 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

What is the naming convention for the default homepage template file in AnQiCMS?

As an experienced CMS website operation personnel of an enterprise, I know that the naming specification of template files is crucial for the smooth operation and efficient management of the website.A clear naming convention not only ensures that the system renders the page correctly, but also greatly improves team collaboration and post-maintenance efficiency.Below, I will elaborate on the naming rules of the default home page template files in Anqi CMS.In AnQi CMS, all template files are stored in the `/template` folder under the system root directory.Each independent website template will be in `/template`

2025-11-06