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.