AnQiCMS (AnQiCMS) is an efficient and flexible content management system that provides great convenience for our users. During 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 small file not only defines the basic information of the template, but also through thetemplate_typeSettings, directly determines how our website will be presented to users on different devices.

To understandtemplate_typeHow to affect the overall display mode of the website, we first need to find this file. In the Anqi CMS,/templateany template folder, you will find aconfig.jsonFile. It is like the 'ID card' of the template you choose, recording the template's name, version, author, and other information,template_typeThis 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.

模式一:自适应(English)

Whentemplate_typeset0时,您的网站将采用Adaptive 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 method according to the screen size, resolution, and other characteristics of the user's device using CSS media queries (Media Queries) and other front-end technologies.Whether it is a desktop computer, tablet, or smartphone, the same URL is accessed, and the same set of HTML structure is seen, with the visual effects optimized according to the device.

  • Advantages:The advantage of this pattern is that the maintenance cost is relatively low, because you only need to update a set of code.同时,它对搜索引擎优化(SEO)非常友好,因为所有设备都指向同一个URL,避免了重复内容或权重分散的问题,搜索引擎更容易抓取和索引。
  • Applicable scenarios:For most corporate websites, content blogs, or simple product display websites, adaptive mode is the recommended choice. It can simplify operations and development work while ensuring a great user experience.

模式二:代码适配(Code Adaptation)

Iftemplate_typeset1,您的网站将进入Code Adaptation Mode. Different from adaptive mode, in code adaptation mode, although the PC and mobile end still share the same main domain name, the system will judge the access device type through server-side logic (such as detecting User-Agent).Once it is identified as a mobile device, it will load a template file specifically designed for mobile devices.mobile/subdirectory.

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

Pattern three: Computer + Mobile (PC + Mobile Independent Sites)

Whentemplate_typeset2At that time, your website will adopt the most thoroughComputer+phone independent site mode. This means that your website will have two completely independent domain names, such aswww.example.comused for PC access, whilem.example.comUsed for mobile access.The system will also judge according to the device type, but if it recognizes a mobile device accessing a PC domain, it may automatically jump to the mobile domain.mobile/the directory.

  • Advantages:This mode provides ultimate control, allowing you to develop completely independent operation 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.
  • Applicable scenarios:Suited for large and medium-sized enterprises that have completely different business needs, brand positioning, or market strategies for PC and mobile platforms. However, the complexity of this model is the highest, requiring you to manage two domain names, handle domain redirection, maintain two or more sets of templates, and pay special attention to SEO aspectscanonicalTags andhreflangProperties to avoid potential issues.

How to choose the right model for you?

Which one to choose.template_typeThe pattern largely depends on your website goals, audience, available resources, and expectations of user experience.

  • Pursue simplicity, efficiency, and universal SEO-friendliness:Tend to choose:Adaptive Mode.
  • Need to provide a more detailed and differentiated experience for mobile, but still want to maintain a single domain:Tend to choose:Code Adaptation Mode.
  • The business requirements are clear, requiring independent operation on both PC and mobile platforms, even with separate domain names:ConsiderComputer+phone independent site modebut be prepared for higher complexity and maintenance costs.

In the Anqi CMS,config.jsonin the document,template_typeSettings, providing powerful control for the front-end appearance 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.


Common Questions (FAQ)

1. How to modifytemplate_typeSet?You need to directly edit the directory of the template you are currently using underconfig.jsonthe file. Find"template_type": 0,(or 1, 2) This line, change the numbers to the pattern you want (0 for adaptive, 1 for code adaptation, 2 for independent sites for computer and mobile), and then save the file.After modification, to ensure that the system can load the new configuration in time, it is recommended that you perform a "Update Cache" operation in the Anqi CMS backend and check whether the website frontend display is normal.

2. Whether all display modes need to create a template separately for mobile?No.

  • Adaptive mode (template_typeFor 0):It is usually not necessary to create a separate template file for mobile devices. It relies on CSS and other front-end technologies to adapt to all devices through a set of templates.
  • Code adaptation mode (template_typefor 1)andComputer + Phone Independent Site Mode (template_typefor 2): Both of these modes require creating a directory namedmobile/The subdirectory, and place special template files designed for mobile phones in it. The system will automatically load the PC or mobile template according to the device type.

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

  • Adaptive mode (template_typeFor 0):通常被搜索引擎推荐为English。Because it uses a single URL, it avoids duplicate content issues, and search engine crawlers only need to crawl once to understand the content of all devices, which is beneficial for the concentration of website authority and ranking improvement.
  • Code adaptation mode (template_typefor 1)Although the content is dynamically changing, the URL remains the same, which has a relatively small impact on SEO.Ensure that the server correctly identifies the User-Agent and provides the correct mobile content, and that the relevance and quality of the content are guaranteed, there should not be too many problems in most cases.
  • Computer + Phone Independent Site Mode (template_typefor 2)This pattern is the most complex in terms of SEO. Since 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 them as duplicate content. Otherwise, it may lead to the dispersion of weight or inclusion issues for mobile sites.