How to ensure that the AnQi CMS website displays content normally on PC, mobile, or adaptive mode?

Calendar 78

When building and operating a website, the display effect of content on different devices is crucial to user experience.AnQiCMS provides a variety of mechanisms and rich features to help users easily cope with content display challenges on PC, mobile, and various adaptive scenarios.Understanding and properly utilizing these features can effectively ensure that your website content is displayed normally and beautifully on any screen.


One, understand the responsive and adaptation mechanism of AnQiCMS

AnQiCMS offers flexible choices in website mode, which directly determines how your website content is displayed on different devices:

1. Adaptive Mode (Template Type 0)This is the current mainstream web design trend, meaning that your website uses a set of template codes, through CSS media queries (Media Queries) and JavaScript and other technologies, automatically adjust the layout and element size according to the screen size, resolution and other characteristics of the user's device.In this mode, you do not need to maintain multiple sets of templates for different devices, all content on PC, tablet, and mobile will be adjusted responsively through the same set of code.AnQi CMS allows you to choose this template type and depends on the responsive design capabilities of your front-end template.

2. Code Adaptation Mode (Template Type 1)In this mode, your website will prepare two independent templates separately for PC and mobile endpoints.When a user visits the website, AnQiCMS will judge whether it is a PC or a mobile device based on the User-Agent information of the visited device and automatically load the corresponding template.This means that mobile users will see layouts and content presentations specially optimized for mobile screens.To achieve this, you need to create a namedmobile/In the subdirectory, and place your mobile template file there.

3. PC+Mobile independent site mode (Template Type 2)This pattern goes beyond code adaptation, allowing you to use completely independent domain names or subdomains for PC and mobile ends, such aswww.yourdomain.comused for PC, andm.yourdomain.comUsed for mobility. In this case, AnQiCMS will recognize different domain requests and point to independent templates and content.In the "Global Settings" on the backend, you need to explicitly configure the "Mobile End Address" to ensure the system can correctly guide mobile users to access the specified mobile site.

Choosing the right mode is the first step to ensure the normal display of content, which lays a foundation for subsequent template design and content optimization.

Chapter 2: The Key to Template Design and Content Structure

A good template design is the core of normal display of content across devices. AnQiCMS has some basic conventions and powerful features in template creation:

1. Uniform Encoding and Static Resource ManagementAll template files should use UTF-8 encoding to avoid garbled text issues. It is recommended to store the static resources such as styles (CSS), JavaScript scripts, and images used in the templates in a unified location./public/static/Under the directory. AnQiCMS'TemplateUrlTags can help you correctly refer to these resources, ensuring they can be loaded normally on different devices.

2. Maintenance of independent templates for mobile devicesIf you choose the "code adaptation" or "PC+Mobile independent site" mode, then inmobile/Maintaining a set of template structures under the directory that aligns with the PC version is crucial. This means that the files that exist on the PC versionindex.html/detail.htmlare inmobile/The directory should also have a corresponding mobile version file to provide a mobile browsing experience.

3. Make flexible use of template tagsAnQiCMS provides rich template tags to control content output. For example,archiveDetail/categoryDetail/pageDetailthese tags can be flexibly selected when calling imagesLogo(usually the main image),Thumb(thumbnail) orImages(Group image), This allows you to load images of different sizes according to the device size, or to implement lazy loading of images (vialazy="data-src"properties). For rich text content, use{{内容字段|safe}}The filter is crucial to ensure that HTML code is parsed correctly and not displayed as escaped.truncatecharsandtruncatewordsFilters that can help you intelligently truncate text to avoid overflow when the content display area is limited.

3. Content editing and media resource optimization

Even if the template design is good, the optimization of the content itself directly affects the display effect:

1. Smart processing of image resourcesImages are an important factor in web page loading speed and display quality. AnQiCMS provides multiple image optimization features in the "Content Settings":

  • WebP image format: Enabling WebP conversion can significantly reduce image file size and speed up mobile loading.
  • Image auto-compression: The system can automatically compress the large image uploaded to the specified width to avoid loading large image resources on small screen devices.
  • Thumbnail Processing MethodYou can choose strategies such as 'Proportional scaling based on the longest side', 'Fill based on the longest side', or 'Crop based on the shortest side' to generate thumbnails, ensuring the coordination of image size in different display scenarios.
  • Default thumbnail: Setting a default image can prevent the display from being blank or the style from being confused due to the lack of content images.
  • Remote image and external link management: Downloading remote images to local can improve website loading stability, and filtering external links can maintain content purity and SEO advantages.

2. Display and adaptation of rich text contentDuring content editing, AnQiCMS supports the Markdown editor, making it easier to write structured content. Markdown content needs to be processed on the frontend viarender=trueParameters must be rendered to display as HTML. If you use complex mathematical formulas or flowcharts in the content,help-markdown.mdThe method mentioned in the document for introducing third-party libraries (such as MathJax, Mermaid) is essential, as these libraries ensure that complex elements are correctly parsed and displayed on different devices. For ordinary rich text content, make sure to use|safeFilter to prevent HTML tags from being escaped and displayed as raw code.

Section 4: Background Configuration and Detail Adjustment

In addition to the template and content itself, some global settings in the background also play a guarantee role in the display of the website on different devices:

1. Global website address configurationIt is crucial to fill in the 'Website Address' and 'Mobile End Address' correctly in the 'Global Settings'.Especially in the "PC+Mobile independent site" mode, accurate configuration of the mobile end address is crucial to ensure that mobile users are correctly directed.

2. Static resource path protectionBy{% system with name="TemplateUrl" %}The static resource path called by the tag must match your actual deployment path.This ensures that CSS, JS, and other files are loaded correctly, thereby ensuring that the website's style and interactive effects work normally on all devices.

3. Shutdown status and promptAlthough it does not directly affect the content display, when the website is in "shutdown status", the custom "shutdown prompt" content will be the only information that users can see on any device.Ensure this prompt is clear and friendly, and also an important user experience maintenance.


By the above detailed management and configuration, by reasonably utilizing the various functions provided by AnQiCMS, you can effectively ensure that your website content is displayed normally and excellently on PC, mobile, or adaptive modes.

Frequently Asked Questions (FAQ)

1. Why did I set a mobile domain, but the PC site still displays when accessed on a mobile phone? Answer:This usually happens in the "PC+Mobile independent site" mode.First, please check whether the "Global Settings" of the background has the "Mobile End Address" configured correctly, ensure that the domain name accessed by the phone is consistent with the mobile end address set here.Next, confirm your templateconfig.jsonin the filetemplate_typeIs it set to 2 (computer + mobile)? Finally, check the Nginx or Apache configuration on the server to ensure that the mobile domain is correctly pointing to the corresponding entry of AnQiCMS, and that the reverse proxy or redirection rules of Nginx or Apache are not incorrectly directing mobile requests to the PC site.

2. How can I optimize the uploaded images that are too large on the mobile end? Answer:You can optimize it in the "Content Settings" of the AnQiCMS backend.Enable the 'Auto-compress large images' feature and set an appropriate 'Auto-compress to a specified width' (for example, 800px or smaller).Moreover, choosing the appropriate 'thumbnail processing method' and 'thumbnail size' is also very helpful.In the template, prefer to use pass through{{item.Thumb}}or{{item.Logo}}The address obtained by the tag is the thumbnail address instead of the original large image address, and it is配合CSS style to limit the maximum width of the image (such asmax-width: 100%; height: auto;If the image is still too large, consider enabling the "Enable Webp image format" option to further reduce the size of the image file.

**3. I used the same content block under

Related articles

How to set an independent display template for a specific page or content block in AnQi CMS?

In the daily operation of Anqi CMS, we often encounter such needs: certain pages or content need to break away from the unified style of the website and present in a unique way.This could be to highlight an important product, create a dedicated landing page for a special topic event, or simply make the "About Us" page more brand-specific.

2025-11-08

How to optimize the URL structure of Anqi CMS to improve search engine results?

In the world of digital marketing, a website's URL is not just a string of addresses; it is also the key for users and search engines to understand the content of the web page.A well-optimized URL structure not only enhances user experience but also significantly improves the website's crawling and ranking performance by search engines.For those who operate websites using AnQi CMS, using the powerful functions provided by the system to optimize the URL structure is an important step to improve the display effect of search engine results.Why is optimizing URL structure so important?

2025-11-08

How can AnQi CMS be configured and display multilingual content to expand the international market?

Expand the international market, allowing your content to reach global users is an important part of many enterprises' digital strategies.AnQiCMS (AnQiCMS) is well aware of this need and therefore built-in strong multilingual support and multi-site management capabilities from the very beginning, helping users efficiently configure and display multilingual content. ### Embarking on the journey of internationalization: The cornerstone of multilingual support AnQi CMS is committed to providing small and medium-sized enterprises and content operation teams with an efficient and flexible content management platform.

2025-11-08

How to customize the front-end content display layout of Anqi CMS website?

AnQiCMS provides highly flexible frontend content display layout customization capabilities, allowing websites to present unique visual effects and information structures according to specific needs.This is not only about the appearance of the website, but also about how to deliver content efficiently and accurately to visitors.By understanding the template mechanism and various functions of AnQiCMS, users can easily achieve fine-grained control from the overall theme style to the display of single content.

2025-11-08

How to extract and display the thumbnail and cover image of the document content in Anqi CMS?

In AnQi CMS, managing and displaying document content thumbnails and cover images is an important aspect for enhancing the visual effects of a website, optimizing user experience, and improving search engine friendliness.AnQiCMS provides a flexible mechanism to handle these image resources, whether they are automatically extracted from the content or manually uploaded and specified, they can be managed in detail in the background and called through simple template tags on the front end.

2025-11-09

How to use the recommended attributes of Anqi CMS (such as headlines, sliders) to control the display of homepage content?

When building and maintaining a website, the homepage is undoubtedly the first stop for users to visit, and its way of displaying content directly affects user experience and information communication efficiency.A meticulously planned and flexible homepage layout that can effectively attract visitors, guide traffic, and highlight the core value of the website.AnQiCMS provides a series of powerful content recommendation features, allowing you to easily control the dynamic display of homepage content and meet various operational needs.Flexible use of AnQi CMS recommended attributes AnQi CMS in content management

2025-11-09

How does the custom content model of AnQi CMS affect the display of front-end data fields?

In website content management, flexibility is the key to improving efficiency and user experience.AnQiCMS (AnQiCMS) performs well in this aspect, with its custom content model feature being particularly powerful.It not only makes content management more organized, but also directly affects the way website front-end data is displayed, making it easy for the website to adapt to various content structures and business needs. ### Understanding Custom Content Model One of the core strengths of Anqi CMS lies in its "flexible content model".

2025-11-09

How to set the SEO display rules for article, product, page titles and other content in AnQi CMS?

In website operation, the content title is like the facade of the website, it is not only the first impression seen by visitors, but also an important basis for search engines to understand the content of the page and judge its relevance.A meticulously optimized content title that can significantly improve the click-through rate (CTR) and ranking of the website.AnQiCMS (AnQiCMS) as a highly SEO-friendly content management system, has provided us with very flexible and powerful tools to finely set the SEO display rules for articles, products, pages, and other content. Next

2025-11-09