How to implement a custom Banner image carousel display effect in AnQiCMS and call it by group?

Calendar 👁️ 75

In website operation, the Banner carousel is an important component to attract users' attention, display core content, or promote activities.AnQiCMS as an efficient and flexible content management system provides multiple ways to implement a custom Banner image carousel effect and can be grouped according to different needs.This not only makes the website interface more dynamic and beautiful, but also accurately presents the content to the target users, improving operational efficiency.

AnQiCMS implements the strategy for Banner rotation

AnQiCMS has fully considered the diversity of content display in design, providing several practical strategies for Banner rotation.We can choose the most suitable implementation method based on the purpose and management granularity of the Banner image.

Strategy 1: Utilize the global Banner list for grouped calls (recommended)

This method is suitable for those who need to display different theme banners in different areas of the website, such as the large picture carousel on the homepage, promotional carousels on product classification pages, and focus images in the news center.AnQiCMS provides a dedicated Banner list feature, allowing us to group these Banners for flexible invocation.

1. Backend configuration: Create and manage Banner groups

The AnQiCMS admin interface usually includes a 'Banner Management' or similar module (although it is not directly listed in the provided documentation, the existence of the 'Home Banner List Tag' suggests this feature).Here, we can easily create and manage different Banner groups.

  • Create Banner group:We can name a group of Banners according to actual needs, such as 'Home Page Large Image', 'Corporate Culture Carousel', or 'Flash Sale'.Each group name should clearly reflect its purpose.
  • Upload Banner image:You can upload multiple images under each group. To ensure uniformity and beauty in the display, it is recommended to upload images of the same size and proportion.
  • Fill in the Banner information:Set the corresponding link address (Link), image description (Description), image alternative text (Alt), and title (Title) for each image.This information not only helps SEO, but also provides friendly hints when images fail to load and adds text descriptions to the carousel.

In this way, we can create an unlimited number of Banner groups in the background and configure multiple carousel images for each group, greatly enhancing the flexibility of Banner management.

2. Template invocation: flexible display by group

When calling these grouped Banners in the front-end template, the template tag feature of AnQiCMS is particularly powerful. We can usebannerListLabel, and throughtypeThe parameter specifies the Banner group to be called.

Suppose we created a Banner group named \index.htmlThis can be called in,

{% bannerList banners with type="首页大图" %}
    <div class="swiper-container my-banner-carousel">
        <div class="swiper-wrapper">
            {% for item in banners %}
            <div class="swiper-slide">
                <a href="{{item.Link}}" target="_blank">
                    <img src="{{item.Logo}}" alt="{{item.Alt}}" class="w-100" />
                    <div class="banner-caption">
                        <h3>{{item.Title}}</h3>
                        <p>{{item.Description}}</p>
                    </div>
                </a>
            </div>
            {% endfor %}
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>
    </div>
{% endbannerList %}

In this code block,{% bannerList banners with type="首页大图" %}It will get all Banner images under the “Home Big Picture” group, and then through{% for item in banners %}Loop through each image's information, includingitem.Logo(Image address),item.Link(Link),item.Alt(Image alternative text) anditem.Title(Title),item.Description(Description). External.swiper-containerandswiper-slideThe structure is reserved for the commonly used front-end Swiper carousel library HTML structure.

Strategy two: Set a dedicated Banner for specific categories or single pages.

In addition to the global group Banner, AnQiCMS also allows us to upload exclusive Banner images for specific document categories or single pages.The advantage of this method is that the Banner content has a stronger relevance to the category or page it belongs to, and it is also more intuitive to manage.

1. Backend configuration: Upload Banner in categories or single pages

  • Document category Banner:Enter AnQiCMS backend's 'Content Management' -> 'Document Category'.When editing a category, at the bottom of the category editing page, there is usually an option for a 'Banner image'.We can upload multiple images here, which will serve as the exclusive carousel banner for this category.
  • Single page Banner:Similarly, when editing a single page (such as the "About Us" or "Contact Us" page) under "Page Resources" -> "Page Management", you can also find the "Banner Image" option, and upload multiple exclusive Banner images for it.

2. Template Call: Precise Display Location

In the corresponding category list page template (for example{模型table}/list.html) or single page template (for examplepage/detail.html), we can usecategoryDetailorpageDetailTag to get these exclusive Banner images.

Call in the category page template:

{% categoryDetail categoryData with name="Images" %}
{% if categoryData %}
<div class="category-banner-carousel">
    <div class="category-banner-wrapper">
        {% for imageUrl in categoryData %}
        <div class="category-banner-slide">
            <img src="{{imageUrl}}" alt="{% categoryDetail with name='Title' %}" class="w-100" />
        </div>
        {% endfor %}
    </div>
</div>
{% endif %}

here,{% categoryDetail categoryData with name="Images" %}It will directly return an array of all Banner image URLs under the current category. LoopimageUrlYou can get the address of each image.

Call in the single-page template:

{% pageDetail pageData with name="Images" %}
{% if pageData %}
<div class="page-banner-carousel">
    <div class="page-banner-wrapper">
        {% for imageUrl in pageData %}
        <div class="page-banner-slide">
            <img src="{{imageUrl}}" alt="{% pageDetail with name='Title' %}" class="w-100" />
        </div>
        {% endfor %}
    </div>
</div>
{% endif %}

Similar to the category Banner,{% pageDetail pageData with name="Images" %}It is used to get the current single-page configuration Banner image array.

Implementation ideas for front-end carousel effects

AnQiCMS is responsible for providing the data for Banner images, while the actual carousel animation effect needs to be implemented through front-end HTML, CSS, and JavaScript.

  1. HTML structure:The above template code has shown the basic HTML structure, usually an outer container (such asdiv.swiper-container) wrapping a list of image containers (such asdiv.swiper-wrapper), it includes multiple image items such asdiv.swiper-slide), place each item in<a>Tags and<img>.
  2. CSS style:You need to set the appropriate size and overflow hidden for the carousel (`overflow:

Related articles

Does AnQiCMS support displaying two-level and even multi-level dropdown categories or product documents in the navigation menu?

In website operation, a clear and intuitive navigation menu is a key link to improve user experience and guide content browsing.Many users want to implement dropdown menus in the main navigation when building websites, to hierarchically display related categories or product documents, making it convenient for visitors to quickly find the information they need.So, can AnQiCMS meet our needs in this aspect?

2025-11-09

How to control whether the website name suffix is attached to the home page title in the AnQiCMS home page TDK settings?

The website's homepage title (Title) is one of the key elements of Search Engine Optimization (SEO), which not only directly affects the willingness of users to click on the website in search results but also carries the important responsibility of brand information delivery.In AnQiCMS (AnQi Content Management System), we often encounter a problem: how to flexibly control the home page title so that it can display the core content while optionally adding or not adding the website name as a suffix?AnQiCMS provides an intuitive and efficient setting method.

2025-11-09

How to configure the thumbnail generation processing method (such as cropping, scaling by the longest side) for AnQiCMS to optimize display effects?

In content operation, images play a crucial role, and thumbnails, as the 'face' of the content, directly affect the first impression and click intention of users.A clear, beautiful, and fast-loading thumbnail that not only enhances the overall visual experience of the website but also effectively optimizes the search engine crawling and ranking, truly a win-win situation.How do we finely tune the thumbnail generation processing method in AnQiCMS to achieve **display effects?Why is thumbnail configuration so important?

2025-11-09

How to set up AnQiCMS to automatically compress large images and specify display width to improve page loading performance?

In today's digital age, the loading speed of a website directly affects user experience, search engine rankings, and even business conversion rates.Images, as an important part of web content, are often one of the key factors affecting page performance, in terms of their size and loading methods.If there are a large number of unoptimized large images on the website, even if the content is精彩, it may still deter visitors.

2025-11-09

Does AnQiCMS provide Json-LD tags to optimize the display of structured data snippets in search results?

When using AnQiCMS for website content operations, we often pay attention to many details of search engine optimization (SEO), among which structured data, especially Json-LD format, plays an increasingly important role in improving the display effect of search results.Whether AnQiCMS supports this feature, the answer is yes, and it provides flexible application methods.AnQiCMS has built-in support options for structured data in its backend management system.

2025-11-09

How to display the language name, language code, and corresponding Emoji or icon of the current site in AnQiCMS?

AnQiCMS provides a flexible and efficient solution for building multilingual websites, allowing your content to easily reach global users.In a multilingual site, it is crucial to clearly display the language information of the current page to visitors and provide convenient language switching options, which are essential for improving user experience and the professionalism of the website.Today, let's discuss how to naturally display the language name, language code, and even vivid Emoji expressions or icons on the front page of your AnQiCMS website, making your multilingual website more attractive.

2025-11-09

How to control the display and SEO impact of links in the AnQiCMS friend link list according to the `nofollow` attribute?

In website operation, friend links are one of the important ways to improve website weight and expand external link resources.However, as search engine algorithms continuously evolve, how to finely manage these links, especially the application of the `nofollow` attribute, has become a topic that web administrators cannot ignore.AnQiCMS as a content management system focusing on SEO optimization, provides users with flexible link management functions, allowing you to effectively control the display and SEO impact of links.###

2025-11-09

How does AnQiCMS's `lorem` tag assist in generating placeholder text for page display testing in template development?

During the development and testing phase of a website template, we often encounter a tricky problem: how to accurately evaluate the layout, style, and visual performance under different content lengths without real content?Manually filling in dummy data is not only inefficient but also difficult to simulate the richness of real content.AnQiCMS (AnQi CMS) provides a very practical auxiliary tag for template developers - `lorem`, which can easily generate placeholder text and greatly simplify the work of page display testing.### `lorem`

2025-11-09