How does the `template_type` setting in `config.` affect the overall display mode of the website?

Calendar 👁️ 73

AnQiCMS (AnQiCMS) is an efficient and flexible content management system that provides great convenience to our users. In the process of building and operating a website, there is a core configuration file -config.jsonIt plays a crucial role in each template directory. This tiny file not only defines the basic information of the template, but also through itstemplate_typeSettings, directly determines how our website will be displayed to users on different devices.

To understandtemplate_typeHow does it affect the overall display mode of the website, we first need to find this file. In the Anqi CMS's/templatedirectory, you will find a template folder set.config.jsonThe file. It is like the 'ID card' of the template you have chosen, recording the template's name, version, author, and other information, andtemplate_typeIt is one of the key configuration items. The value of this field is usually a number, corresponding to the three website display modes supported by AnQi CMS.

Pattern one: Responsive

Whentemplate_typeis set to0At that time, your website will adoptAdaptive mode. In this mode, you only need to design and maintain a set of template files.This template will intelligently adjust the page layout and content presentation style according to the screen size, resolution and other characteristics of the user's device using CSS media queries and other front-end technologies.Whether it is a desktop computer, tablet, or smartphone, the same URL is accessed, the same set of HTML structure is seen, and the visual effects are optimized according to the device.

  • Advantage:The advantage of this pattern is that the maintenance cost is relatively low because you only need to update a set of code.At the same time, it is very friendly to search engine optimization (SEO) because all devices point to the same URL, avoiding issues of duplicate content or weight dispersion, making it easier for search engines to crawl and index.
  • Application scenarios:For most corporate websites, content blogs, or simple product display websites, adaptive mode is the recommended choice, which can maximize the simplification of operation and development while ensuring user experience.

Pattern two: Code Adaptation

Iftemplate_typeis set to1Your website will enterCode Adaptation Mode. Unlike the adaptive mode, in the code adaptation mode, although the PC and mobile ends still share the same main domain name, the system will judge the access device type through the server-side logic (such as detecting the User-Agent).Once it recognizes a mobile device, it will load a template file specifically designed for mobile endpoints.These mobile templates are usually stored in your main template directory.mobile/In the subdirectory.

  • Advantage:This mode allows you to provide two completely different content structures and interaction experiences for PC and mobile devices.When the mobile end needs to have a significant difference in design, function, or even content from the PC end, code adaptation provides greater flexibility.For example, you can streamline content and optimize the operation process for mobile devices to better suit the characteristics of touch screen devices.
  • Application scenarios:When you want to provide unique, customized experiences for mobile users, and the existing content model or design is difficult to perfectly present in adaptive mode, code adaptation is a good choice.But this also means that you need to invest more time and effort to develop and maintain two independent templates.

Mode three: PC + Mobile (Independent Sites for PC and Mobile)

Whentemplate_typeis set to2At that time, your website will adopt the most thoroughComputer + mobile independent site mode. This means that your website will have two completely independent domain names, for examplewww.example.comused for PC access, andm.example.comUsed for mobile access. The system will also judge according to the device type, but if it detects a mobile device accessing the PC domain name, it may automatically jump to the mobile domain name.Each domain loads its own independent template file, the mobile template is also located inmobile/directory.

  • Advantage:This mode provides ultimate control, allowing you to develop completely independent operational strategies for PC and mobile sites, including content, functional modules, and even profit models.For example, e-commerce websites may want to highlight flash sales on mobile devices while displaying more detailed product information on PC endpoints.
  • Application scenarios:Suitable for large and medium-sized enterprises with completely different business needs, brand positioning, or market strategies for PC and mobile platforms. However, the complexity of this model is also the highest, requiring you to manage two domain names, handle domain name redirection, maintain two or more sets of templates, and pay special attention to SEO use.canonicalTags andhreflangAvoid potential issues by properties.

How to choose a suitable model for you?

Choose which onetemplate_typeThe pattern, largely depends on your website goals, audience, available resources, and expectations for user experience.

  • Pursue simplicity, efficiency, and SEO-friendliness:Tend to chooseAdaptive mode.
  • Need to provide a more detailed and differentiated experience for mobile devices, but still want to maintain a single domain:Tend to chooseCode Adaptation Mode.
  • Business requirements are clear, requiring independent operation of PC and mobile端 completely, even with independent domains:ConsiderComputer + mobile independent site modeBut be prepared to deal with higher complexity and maintenance costs.

In AnQi CMS,config.jsonIn the filetemplate_typeSet, providing strong control for the front-end performance of your website.A deep understanding of the characteristics and applicable scenarios of each pattern will help you build the website experience that best meets your needs.


Frequently Asked Questions (FAQ)

1. How to modifytemplate_typeSettings?You need to directly edit the directory of the template you are currently using.config.jsonFile. Find."template_type": 0,(or 1, 2) This line, change the numbers to the mode you want (0 for adaptive, 1 for code adaptation, 2 for independent site for computer and mobile), and then save the file.After modification, to ensure that the system can load the new configuration in a timely manner, it is recommended that you perform a "update cache" operation in the Anq CMS background and check whether the website front-end display is normal.

2. Do all display modes need to create a separate template for mobile devices?No.

  • Adaptive mode (template_typefor 0)It is usually not necessary to create a separate template file for mobile devices. It depends on CSS and other front-end technologies, adapting all devices through a single template.
  • Code adaptation mode (template_typefor 1)andComputer + mobile independent site mode (template_typefor 2): Both of these modes require creating a file named in the main template directorymobile/The subdirectory, and place specially designed template files for mobile devices. The system will automatically load PC or mobile templates according to the device type.

3. Differenttemplate_typeWhat impact does setting have on the website SEO?

  • Adaptive mode (template_typefor 0)It is commonly recommended by search engines as a**practice. Because it uses a single URL, it avoids the problem of duplicate content, and search engine crawlers only need to crawl once to understand the content of all devices, which is beneficial for the concentration of website weight and ranking improvement.
  • Code adaptation mode (template_typefor 1): Although the content changes dynamically, the URL remains unchanged, which has a relatively small impact on SEO.Ensure that the server can correctly identify the User-Agent and provide the correct mobile content, and that the relevance and quality of the content are guaranteed, there will usually be no major problems.
  • Computer + mobile independent site mode (template_typefor 2)This pattern is the most complex in terms of SEO. Since the PC and mobile end are different URLs, you need to implement appropriate SEO strategies, such as usinglink rel="canonical"andlink rel="alternate"Label to clarify the relationship between PC and mobile pages, to avoid search engines treating it as duplicate content. Otherwise, it may lead to the dispersion of the weight of the mobile site or inclusion issues.

Related articles

How does AnQiCMS automatically apply the default display template for documents or categories through naming conventions?

In website operation, template management is the key to ensuring the professionalism and consistency of content display.For many operators, manually selecting or specifying a template for each new article or category is undoubtedly a repetitive and time-consuming task.AnQi CMS understands this pain point, therefore it introduces a set of intelligent naming conventions, allowing the system to automatically identify and apply default display templates, thereby greatly simplifying our daily operations.The cleverness of this feature lies in AnQiCMS's ability to intelligently associate content with preset design styles according to the specific naming rules of template files

2025-11-08

Where should the mobile-specific template file be stored to be recognized by AnQiCMS?

Provide special optimization for the mobile experience of the website in AnQiCMS (AnQiCMS), which is a very practical requirement.Benefiting from the flexible template mechanism of AnQiCMS, we can easily achieve this goal.When it is necessary to provide a set of independent template files for mobile devices, the storage location and configuration method of these templates are crucial.

2025-11-08

Why is UTF8 encoding crucial for the display of content in AnQiCMS templates?

## Content display no longer troubles: Why is UTF-8 encoding so critical for AnQiCMS templates?In the process of building and operating a website with AnQiCMS, we often strive for the website's efficiency, stability, and diverse display of content.However, there is a seemingly basic but actually crucial link that, if not handled properly, will cause all our efforts to be wasted - that is the character encoding of the template file.Especially for AnQiCMS, UTF-8 encoding is not just a recommendation, it is the core foundation to ensure that website content is displayed correctly and clearly.

2025-11-08

How to use conditional judgment and loop control to dynamically adjust the display of content?

In Anqi CMS, we often encounter scenarios where we need to display different information based on specific conditions or repeat a series of contents.At this time, by flexibly using conditional judgment and loop control, the website content can become more vivid and intelligent.The AnQi CMS template feature provides powerful syntax support similar to the Django template engine, through these tags, we can easily achieve dynamic content adjustment without writing complex background code. ### Conditional judgment: Make the content 'speak to people' Conditional judgment is the basis for dynamic content display.Imagine

2025-11-08

How to reuse header, footer and other common display elements in AnQiCMS templates?

In website operation, efficiency and consistency are the key to success.When you manage a website, you will find that many elements appear repeatedly on different pages, such as headers, footers, navigation bars, sidebars, and so on.If you copy and paste this code manually every time, it is not only inefficient but also prone to errors, not to mention the cumbersome task of adjusting each one individually during subsequent modifications.Fortunately, AnQiCMS's template system is designed to be very flexible, providing powerful mechanisms to help us efficiently reuse these common display elements, ensuring the uniformity of the website style and making maintenance easier.

2025-11-08

How to embed reusable display components such as sidebars or breadcrumbs in a page?

In website operation, building an efficient and easy-to-maintain website is the key to success.AnQiCMS (AnQiCMS) is well aware of this, providing a flexible template mechanism that allows us to easily embed reusable display components on the page, such as sidebars and breadcrumb navigation.This modular method not only improves development efficiency, but also ensures the consistency of the overall style of the website and future maintainability.This article will delve into how to effectively create and embed these important reusable components using the template system in AnQiCMS.##

2025-11-08

Which is the default display template file for the home page?

The homepage, as the first impression for users visiting your site, is of great importance.It carries multiple functions such as brand image, core information display, and user guidance.For those who are using or planning to use AnQiCMS (AnQiCMS) to build websites, understanding which file is behind the scenes controlling the display of this key page is the first step in customization and content optimization. AnQi CMS is committed to providing an efficient, customizable content management solution, naturally also providing you with great freedom to control this core page. Then

2025-11-08

Default display template file for article detail page

The Anqi CMS provides a flexible and powerful template mechanism for handling the display of website article detail pages, allowing content operators and developers to finely control the presentation of each article according to actual needs.Understanding the search logic of the default template file is the basis for efficient content management and personalized customization.Firstly, the template files of Anqi CMS are all stored in the `/template` directory and use `.html` as the file extension.

2025-11-08