Ensure that the AnQiCMS website content is perfectly adaptable to display on different devices
Now users have a variety of ways to access websites, ranging from large-screen desktop computers to various sizes of tablets, to compact smartphones, with a huge difference in device size.How can a smooth, beautiful, and feature-complete browsing experience be provided on all these devices, which is one of the keys to the success of website operation.AnQiCMS was designed with this in mind from the beginning, providing us with a variety of powerful features and flexible strategies to ensure that website content can be perfectly adaptable to display on different devices.
How does AnQiCMS achieve the 'magic' of multi-device adaptability?
AnQiCMS provides three flexible website display modes at the bottom level, allowing us to choose the most suitable method according to our actual needs and technical budget, so that the website content can better adapt to various screen sizes.
FirstlyAdaptive mode. This is the most common and recommended method. In this mode, the website only needs a set of templates, and through front-end CSS technologies (such as media queries, flexible layouts, etc.), the content can automatically adjust the layout and style according to the screen size of the access device.AnQiCMS template design inherently supports this responsive layout, as long as we have it in the template'sconfig.jsonfile willtemplate_typeis set to0The system will run in this mode. This means the maintenance cost is relatively low, as only one set of content needs to be updated to be displayed on all devices.
Next isCode Adaptation ModeIf we want to present completely different designs or more refined interactions on different devices, but do not want to maintain two completely independent websites, then code adaptation is a good choice.In this mode, the website still has only one domain name, but AnQiCMS will intelligently judge the user's access device (such as PC or mobile phone), and then dynamically load the corresponding PC template or mobile template.This requires us totemplateCreate an independent directory for the mobile end.mobileThe directory contains template files specifically designed for mobile phones.config.jsonoftemplate_typeNeed to be set to1Thus, when mobile users visit, the system will automatically presentmobilethe template content in the directory.
Finally isPC + mobile phone independent site mode. If our PC site and mobile site need to have completely independent domains, content, and even operational strategies, then AnQiCMS also provides a powerful multi-site management function to support this need.We can set a primary domain for the PC end, and then set an independent subdomain or independent domain for the mobile end, and fill in the 'Mobile end address' in the 'Global Function Settings' on the back end.In this way, content sharing or independent management between two sites can be achieved, inconfig.jsonthe middle oftemplate_typeis set to2This pattern provides the greatest flexibility, but in comparison, the maintenance cost and content management complexity will also be higher.
Content is king: Ensure that media resources are 'form and spirit' intact on any screen
In addition to the choice of website display mode, the optimization of the content itself, especially the adaptation of multimedia resources such as images and videos, is crucial for achieving perfect adaptive display.AnQiCMS also provides many conveniences in content management, helping us easily cope with these challenges.
Image ProcessingIt is of great importance in adaptive display. Large images not only load slowly but also severely affect the browsing experience of mobile devices.In AnQiCMS' 'Content Settings', we can find a series of thoughtful features:
- Do you want to enable Webp image format:Enable this feature to automatically convert uploaded JPG, PNG, and other images to a smaller WebP format, significantly improve image loading speed without affecting visual quality, especially benefiting mobile users.
- Whether to automatically compress large images and specify width:We can set whether to automatically compress large images that exceed a certain width, such as default compression to 800 pixels wide. This can effectively control the size of image files and reduce user traffic consumption.
- Thumbnail processing method and size:AnQiCMS supports various thumbnail generation methods (such as proportional scaling by the longest side, cropping by the shortest side, etc.) and custom sizes.This ensures that the content matches the appropriate image size whether displayed on the list page or the detail page, avoiding stretching or distortion.
- Batch regenerate thumbnails:If the design style or requirements of the website change, you need to adjust the thumbnail size, this feature can update all thumbnails of the images in one click, saving a lot of manual operations.
- Image lazy loading:When making templates, through
lazy="data-src"Such tag usage can achieve image lazy loading, that is, only load the image when it enters the user's viewport, which can significantly improve the initial loading speed of the page, especially effective for long pages.
Video contentAlthough AnQiCMS itself does not directly handle video adaptive encoding, it provides a rich text editor that supports video insertion, and we can make use of the CSS flexible container (such asaspect-ratioproperty orpadding-bottomTips) to ensure that the embedded video player maintains the correct aspect ratio on different screen sizes and does not overflow or distort.
Polished: Template and design details.
AnQiCMS's template system is based on the Django template engine syntax, which provides us with great flexibility to build and optimize adaptive interfaces.
- Modular design:Template support
include(Refer to public code snippets such as headers and footers) andextends(Inheriting the basic skeleton) tag, which allows us to centrally manage adaptive CSS and JS code, avoid repetition, and make it easier to make local adjustments and maintenance. - Conditional statements and variable control:By
ifLogical judgment label, we can decide in the template whether to render certain content or apply specific styles based on specific conditions (such as certain background custom parameters), which is very useful for implementing more complex adaptation logic.withTags can temporarily define variables for easy data passing between different template fragments. - Custom content model:AnQiCMS allows us to customize the content model, which means we can design the most suitable fields and layout for specific content types (such as articles, products, events).Adapting front-end design, it can elegantly present on various devices regardless of how complex the content structure is.
Operation Efficiency: Continuous Optimization and Maintenance
The adaptive display of the website is not a one-time task, continuous optimization and maintenance are also important. The background settings and function management of AnQiCMS also indirectly support this goal:
- Cache Update:Promptly clear the system cache to ensure that the front-end displays the latest content and style, especially after updating the template or adjusting the image settings.
- Traffic statistics and crawler monitoring:Focus on the traffic sources and user behavior of different devices, which helps us discover potential compatibility issues and optimize content and design accordingly.
- Static rules:A friendly URL structure not only benefits SEO but also makes it simpler for users to share links, indirectly enhancing the overall website experience.
In summary, AnQiCMS, as an enterprise-level content management system, provides multi-dimensional support from the selection of underlying architecture to content optimization tools, to flexible template design, ensuring the adaptive display of website content.By making good use of these features, we can easily build websites that provide an excellent user experience on any device, thereby better serving our users and business goals.
Frequently Asked Questions (FAQ)
1. I have selected the adaptive template type, but why are some images still displaying too large or distorted on mobile phones?This is usually because the CSS style does not fully adapt to the performance of images on small screens, or because the image source file itself has a high resolution and has not been compressed.You can check whether the options such as 'Whether to automatically compress large images', 'thumbnail processing method and size', etc. in the 'Content Settings' are turned on and configured properly.At the same time, make sure to add such images to your template CSSmax-width: 100%; height: auto;and consider using responsive styles,lazy="data-src"Optimize image lazy loading.
2. If I use the adaptive mode first, and then want to switch to the PC + mobile independent site mode, will the previous content be lost?I can't. AnQiCMS's content data is stored independently in the database, switch to website mode (inconfig.jsonmodify in thetemplate_typeIt usually only affects which set of templates the system loads to render content, and does not directly lead to the loss of content data.If you want to switch to the PC + mobile independent site mode and use a different domain, you need to add a new site in the "multi-site management" backend and configure its domain and database information.The Anqi CMS multi-site management function can effectively isolate data and configuration between different sites, while ensuring data security.
3. I want to set up a separate navigation menu for mobile devices that is different from the PC version, can AnQiCMS achieve this?Can be. In AnQiCMS' website navigation settings, you can click on 'Navigation Category Management' to add a new navigation category, such as 'Mobile End Navigation'.Then add a menu link designed for mobile devices to this new navigation category.On your mobile template (if it is in code adaptation mode, then in themobileThe template under the directory; if it is in independent site mode, then use the template in the new site),{% navList navs with typeId="您移动端导航类别的ID" %}Tag to call this specific mobile navigation list.