Hello!As an experienced CMS website operation personnel for Anqi, I fully understand the importance of providing an optimized experience for different sites in the trend of increasing mobile traffic.The advantages of AnQi CMS in multi-site management and template flexibility make it very convenient to specify a dedicated mobile template for each independent site.Below, I will elaborate on how to achieve this goal in the Anqi CMS.
In AnQiCMS multi-site management, specify the mobile template for an independent site
In the ecosystem of AnQi CMS, specifying independent mobile templates for multiple sites is a powerful feature that allows operators to provide highly customized mobile user experiences for different brands or content branches.This approach goes beyond single responsive design, giving the site the ability to display unique layouts, content, and interactions on mobile devices.
Understand the template adaptation mode of AnQiCMS
AutoCMS provides three main template adaptation modes: adaptive, code adaptation, and independent PC + mobile site.To implement an independent mobile template, we need to choose one of the two latter modes.
Adaptive mode uses a set of templates to automatically adjust the layout to fit various screen sizes, without the need for a separate mobile template.However, when the site requires more refined mobile control or a completely different content presentation, code adaptation or the independent site mode for PC+mobile becomes an ideal choice.
The code adaptation mode automatically loads PC or mobile templates by detecting the user agent (User-Agent) information of the user visiting the device.PC+mobile end independent site mode goes a step further on this basis, allowing for a separate domain name to be bound to the mobile end (such as m.example.com), thus distinguishing PC and mobile end traffic at the domain level and providing users with a more exclusive access path.
Directory structure convention of mobile templates
The organization structure of Anqi CMS templates for mobile devices is clear. Whether you choose code adaptation or PC + mobile independent site mode, all template files designed specifically for mobile devices must be stored in the current template directory.mobile/subdirectory.
For example, if the template you are using is namedmy_custom_template,it is located/template/my_custom_template/,then the corresponding mobile file for that template should be placed/template/my_custom_template/mobile/. Thismobile/The template file naming and structure inside the catalog should be consistent with the PC end template catalog (i.e.,my_custom_templatethe catalog itself). This means that if the PC end hasindex.htmlas the home page, then inmobile/The directory should also contain one.index.htmlTo carry the content of the mobile home page.
Through this standardized directory structure, the AnQi CMS can efficiently identify and call the correct template files, ensuring the expected content is presented on different devices.
Configure the template package.config.json
In the root directory of the template package, there is a file namedconfig.jsonwhich defines the various properties of the template. To enable the independent mobile template feature, the relevant field in this file is crucial.template_typeis the key.
You need to translatetemplate_typeto the value of1(Represents code adaptation)2(Represents PC + mobile phone end). For example, if your template is intended to support PC and independent mobile phone end sites, and the mobile phone end has an independent domain,config.jsonThe relevant part should be as follows:
{
"name": "我的PC移动分离模板",
"package": "my_separated_template",
"version": "1.0",
"description": "一套支持PC和独立手机端域名的AnQiCMS模板",
"template_type": 2,
"status": 0
}
This configuration explicitly indicates to the security CMS system, that this template package includes an independent mobile view, the system will load the corresponding template set based on the user's device type and site configuration.
In AnQiCMS background to specify mobile template for multiple sites
Complete the organization of template filesconfig.jsonAfter the configuration, the next step is to make specific settings for each independent site in the backend management interface of the security CMS.
When you add or edit a site in the "Multi-site Managementtemplate_type: 1)or PC+mobile end independent site(template_type: 2)template.
If you have chosen the PC+mobile independent site mode, you will see a configuration item named 'Mobile End Address' in the 'Global Function Settings' of the site. Here, please be sure to fill in the exclusive mobile domain name of the site (for example)m.yoursite.com)。Ensure that this domain name is correctly resolved to your server IP at the DNS service provider, and that the corresponding reverse proxy rules are configured in your web server (such as Nginx or Apache) to point the mobile domain to the AnQiCMS service port.
Through these detailed backend configurations, each independent site managed in the Anqi CMS can have its exclusive PC and mobile端 templates, and can configure independent mobile domain names as needed to achieve efficient presentation and management of content across different devices.
Concluding remarks
AnQi CMS provides operators with tools to deal with complex content management and diverse user needs with its high flexibility and powerful multi-site management capabilities. Through carefully planned template structures and accurate configurations,config.jsonAnd in the background management, specify the correct template type and mobile address for each site. You will be able to create a first-class mobile user experience for different sites, effectively enhancing brand influence and market competitiveness.
Frequently Asked Questions
问:What are the differences between the "Adaptive" template mode and the "Code Adaptation" mode of AnQi CMS? How should I choose?
答:自适应模式是指一套模板代码能够根据访问设备的屏幕大小和特性自动调整布局和样式,通常使用CSS媒体查询等技术实现,无需单独的移动端模板文件。The code adaptation mode means that you have created two completely independent template files for PC and mobile terminals, and Safe CMS will judge and load the corresponding PC or mobile terminal template based on the User-Agent information of the user's device.The choice of mode depends on your needs.If the content and structure of the site can be highly consistent between PC and mobile, with only layout changes, adaptive mode is simpler; if the mobile end needs to display very different content, features, or interaction logic from the PC end, then the code adaptation mode can provide greater flexibility and optimization space.
问:In multi-site management, can I use different mobile templates for different sites instead of just copying a set of templates?
答:Of course, you can. The multi-site management of Anqi CMS is very flexible. You can design and upload a completely independent template package for each independent site, and each template package can be used in each template package.config.jsonautotemplate_typeauto