How to get and display the carousel or advertisement images on the homepage using the `bannerList` tag?

Calendar 78

In the operation of a website, the homepage carousel or advertising images are undoubtedly the golden area to attract visitors' attention, convey core information, and promote important content.They not only enhance the visual appeal of a website, but are also key to guiding user behavior and promoting content consumption.bannerList.

bannerListThe design初衷 of the tag is to help website managers easily obtain and display the carousel image collections configured in the background.It allows you to flexibly display these carefully designed images at any location on the website, especially in the key areas of the homepage, bringing your website content to life.

To usebannerListLabel, first you need to understand its basic structure and working mode.It will package all the image data that meets the conditions from the background into a list (or an array), which you can iterate over and display in the template.bannersthen cooperate withforLoop through each image in the list one by one:

{% bannerList banners %}
    {# 这里是您循环输出每个 banner 详情的代码块 #}
{% endbannerList %}

In this code block,bannersThat is the name specified for the carousel list we obtain. When you usefor item in bannersthis structure,itemit will represent the detailed data of a picture or advertisement in each loop.

bannerListThe tag also provides some parameters that allow you to finely control which images to retrieve:

  • typeparameters:This isbannerListOne of the core functions of the label.In the Anqi CMS backend management interface, you can set a 'group name' for each uploaded carousel image or advertisement image.For example, you can create a group named "Home Slide" for the home page image carousel, and then create a "Sidebar Ad" group for displaying small promotional images.typeFor example, parameters,{% bannerList banners with type="首页幻灯" %}Thus,bannersThe variable will only include all images under the "Home Slider" group. This grouping mechanism greatly enhances the flexibility of image management.
  • siteIdparameters:If your Anqi CMS system is configured with multi-site management functionality and you want to call the carousel data of another site in the current template, you can usesiteIdParameters are used to specify the ID of the target site. For most single-site users, this parameter is usually set to default and does not require manual setting.

OncebannerListTags retrieve image data.bannersIn the variable, you can pass throughitemAccess the detailed properties of each image to build a complete HTML structure:

  • item.Id:The unique identifier ID of each image in the system.
  • item.Logo:This is the actual URL of the carousel or advertisement image, you need to put it in<img>label'ssrcthe attribute.
  • item.Link:If this image needs to jump to another page after clicking, the target link is stored here.
  • item.Alt:Image alternative text (Alt Text), which is important for website SEO and accessibility improvement

Related articles

How to build a dynamic filter using the `archiveFilters` tag to display documents that meet specific conditions?

How to help users quickly find the information they are interested in when managing a content-rich website, and improve the access experience, is a challenge that every content operator needs to face.AnQiCMS (AnQiCMS) understands this need and therefore provides a powerful `archiveFilters` tag, allowing you to easily build dynamic filters to provide flexible and diverse search methods for website content. Dynamic filter, as the name implies, is to automatically generate filtering conditions for users to choose from based on different attributes of the content.

2025-11-07

How does the `archiveParams` tag display custom field data for AnQiCMS documents?

In AnQiCMS, the flexibility of website content is one of its highlights, which is attributed to its powerful content model custom field function.In addition to standard fields such as article title, content, and publication time, you can also add various custom fields according to business needs for different content models (such as articles, products), such as 'author', 'product model', 'house area', or 'service features'.These custom fields greatly enrich the expression of the website content, making it more closely aligned with practical application scenarios.So, when you tirelessly define and fill in these custom fields in the background

2025-11-07

How to dynamically set and display the page's Title, Keywords, and Description using the `tdk` tag to optimize SEO?

How to make our content better discovered by search engines and attract more potential users is a continuous challenge in website operation.Among them, the Title (title), Keywords (keywords), and Description (description) these three TDK tags are like a series of 'business cards' on our website in the search engine results page, directly affecting the user's click intention and the understanding of the search engine.AnQi CMS knows this and therefore fully considered the dynamic setting of TDK and SEO friendliness in the initial system design.<h3>Importance of TDK

2025-11-07

How to uniformly display the website's contact information, phone number, and email address with the `contact` tag?

How to efficiently manage and uniformly display a company's contact information, such as contacts, phone numbers, email addresses, and addresses, is a seemingly simple problem that often causes headaches.Imagine if this information were scattered across various pages of a website, and once an update is needed, you would have to search and modify each one individually. This is not only time-consuming and labor-intensive, but it is also prone to omissions or inconsistencies.Fortunately, AnQiCMS (AnQiCMS) provides an elegant solution - the `contact` tag, which helps us easily manage and flexibly display contact information.

2025-11-07

How to display comments of the `commentList` tag

In website operation, article comments are an indispensable part of enhancing user interaction and activating the community atmosphere.AnQiCMS (AnQiCMS) provides us with a powerful and flexible comment management function, through the clever use of `commentList` tags, we can easily display the comments of articles on the website front-end.This article will delve into the various functions of the `commentList` tag and its practical application in templates, helping you create an interactive and user-friendly comment section.--- ### Core Tag

2025-11-07

In Anqi CMS template, how to center the product title within a fixed area?

In Anqi CMS template, centering the product title within a fixed area is a common layout requirement, which can effectively enhance the visual aesthetics and user experience of the website.Due to the similar Django template engine syntax adopted by AnQi CMS and its good support for frontend styles, we can achieve this goal by combining HTML structure and CSS styles. ### Understanding Anqi CMS Template Structure Firstly, we need to clarify how the product title is called in the Anqi CMS template.

2025-11-07

How to use the AnQiCMS `ljust` filter to align the navigation menu text to the left and fill with spaces?

AnQi CMS is an efficient and flexible content management system that provides users with rich template tags and filters, helping us easily customize all aspects of the website.Today, we will explore a practical template trick: how to use the `ljust` filter to align your navigation menu text neatly to the left and intelligently fill in spaces, thereby improving the visual consistency and user experience of the website.

2025-11-07

How to align the date and time stamp to the right to a specified length on the AnQiCMS article detail page?

On the article detail page of the website, we often hope that the publication date or update date of the article can be displayed neatly, and sometimes they need to be aligned to the right and occupy a fixed width, so that the page looks professional and beautiful.AnQiCMS provides flexible template tags and filters to help us easily meet this requirement. ### Understanding AnQiCMS Date Handling AnQiCMS typically stores dates and times in the form of timestamps (timestamps).This means calling `{{

2025-11-07