What are the required or commonly used parameters for the `bannerList` tag to configure the home page banner?

As an experienced website operations expert, I am well aware of the importance of the homepage banner in making a first impression on website visitors and guiding user behavior. In AnQiCMS, bannerListLabels are the core tools we use to manage and present these key visual elements.It is designed in a concise and powerful manner, enabling content operators to easily achieve diverse homepage banner display needs.

Today, let's delve into it in depthbannerListWhat are some required or commonly used parameters in the process of using tags, and how can they be skillfully utilized to configure a homepage banner that is both beautiful and practical.


AnQiCMSbannerListLabel: Explanation of required and commonly used parameters for configuring the home page Banner

In the age of digital marketing, the Banner area on the homepage of a website is like the facade of a brand, carrying multiple tasks such as displaying core products, promoting the latest activities, and guiding user paths. AnQiCMS is well-versed in this, providingbannerListThis powerful tag allows website operators to flexibly control the content and presentation of the homepage Banner. Understanding its core parameters is the key to maximizing its effectiveness.

bannerListThe basic usage of the tag is very intuitive, it requires a variable name to hold the retrieved Banner data, and it is followed by{% bannerList 变量名称 %}...{% endbannerList %}Enclose the loop body in the form of. For example, we usually name it.banners:

{% bannerList banners %}
    {# 在这里循环输出每个Banner的数据 #}
{% endbannerList %}

Once we get the Banner list, we can go through it byforto iteratebannersVariable, present the detailed information of each Banner one by one.

Core parameter one:type(Group name) - Flexibly define the display content

When configuring the home page banner, the most commonly used and crucial parameter is probablytypeAlthough it is not absolutely "required", it is almost the key we use to differentiate and manage different Banner areas in actual operation.

typeThe function of the parameterIt lies in the fact that it allows you to perform refined grouping of banners in the AnQiCMS backend.For example, you may wish to display a set of 'Main Visual Carousel' at the top of the homepage, a set of 'Brand Activity Recommendations' in some side area of the page, or a set of 'Seasonal Promotion Banners' on a specific marketing page.You can now create multiple Banner groups in the background and name them separately, such as 'Home Carousel', 'New Products', or 'Brand Story'.

In the template, by specifyingtypeThe value of the parameter allows you to accurately call the Banner list of the required group. For example, if you create a Banner group named 'Home Main Push' in the background, you can call it like this in the template:

{% bannerList banners with type="首页主推" %}
    {% for item in banners %}
        <a href="{{ item.Link }}" target="_blank">
            <img src="{{ item.Logo }}" alt="{{ item.Alt }}" />
            <h5>{{ item.Title }}</h5>
            <p>{{ item.Description }}</p>
        </a>
    {% endfor %}
{% endbannerList %}

IftypeParameter is not specified.bannerListThe label will be obtained by default.type="default"This provides convenience, but it also means that when managing the Banner in the background, it is necessary to develop good categorization habits to ensure that the corresponding Banner is categorized correctly.typeGrouping.

Core parameter two:siteId(Site ID) - Precise control in multi-site environments

For users of single-site websites,siteIdparameters usually do not need to be paid attention to, becausebannerListTags will default to get the current site's Banner data. However, if you are using the powerful multi-site management feature of AnQiCMS and need to call another site's Banner data in a template of a site,siteIdThe parameter becomes indispensable.

siteIdParametersAllow you to explicitly specify which site to retrieve Banner data from.This is especially useful in scenarios of cross-site content sharing or multi-brand display.

{% bannerList banners with siteId="2", type="子站推广" %}
    {# 循环输出子站的Banner #}
{% endbannerList %}

Please note,siteIdThe value should correspond to the site ID you set in the "Multi-Site Management" of AnQiCMS backend.

Available Banner data fields

OncebannerListLabel successfully fetched Banner data, you can then iterate overbannerseach variable (or the variable name you define)itemCome visit the various information it contains. Each BanneritemGenerally provides the following key fields, which are the foundation for building Banner displays:

  • IdThe unique identifier of the banner.
  • LogoThe file path or URL of the Banner image. This is the visual focus of the Banner, and it is crucial to ensure that the image size and quality meet the design requirements.
  • LinkThis is the target URL after the banner is clicked. It is the core to guide users to visit a specific page, product, or event.
  • AltThis is the alternative text for the banner image. It is SEO-friendly and helps improve the accessibility of the website, displaying text when the image fails to load.
  • Description[en] : A brief description of the banner, which can be used for some auxiliary text notes.
  • Title【en】Banner's title.Although it is not explicitly listed in the parameter list of the document, it appears in the example code, indicating that it is a commonly used and demonstrable text field, usually used as the main text on the Banner.

By combining these fields flexibly, you can create a rich and diverse range of Banner display effects, from simple image links to carousel slides with titles and descriptions, even dynamic Banners with CSS animations.

Content Operation Tips

When usingbannerListWhen configuring the Banner with tags, in addition to technical parameters, the following operational strategies can also give you a helping hand:

  1. Consistency in image sizeEnsure that all Banner images within the same group maintain consistent dimensions to avoid layout jumps and enhance user experience.
  2. Clear Call to Action (CTA)?[en]The text and buttons on the banner should clearly indicate what the user will receive after clicking, stimulating the user's desire to click.
  3. [en]Regular updatesMaintain the timeliness and freshness of the Banner content, coordinating with the latest promotions or products to attract users' continuous attention.

Summary

bannerListTags are a powerful and flexible tool for configuring the home page banner in AnQiCMS. By cleverly utilizing itstypeparameters for content grouping, and precisely utilizing them in a multi-site environmentsiteIdYou can effectively manage and display a variety of Banner content.Combine the rich field information it provides, and you will be able to easily create an eye-catching, high-conversion website facade.


Common Questions (FAQ)

  1. Question: How to manage and create Banner groups in the AnQiCMS backend?Answer: In the AnQiCMS backend management interface, there is usually a menu item related to "Page Resources" or "Content ManagementEnter, and you can create new Banners. When editing a Banner, there is usually an option for 'Group' or 'Type'. Here, you can customize the group name and assign the Banner to the corresponding group.typeParameters are used to call these groups.

  2. Question: I have set upbannerListLabel, but the home page banner is not displayed. Could there be a problem?Answer: First, please check if a Banner has been created in your "Banner ManagementtypeThe value of the parameter) does not match the one you used in the template.typeIs the parameter fully matched, including case sensitivity. If not specifiedtypeParameter, it will call the "default" group's Banner by default. Finally, check the image path.Logowhether the field is correct, as well as in the template codeforDoes the translation of 'loop and field invocation' contain spelling errors?

  3. Q:bannerListDoes the tag support conditional display based on user role or access time?Answer:bannerListThe tag itself does not directly provide functionality for conditional display based on user roles or access time, it mainly responsible for retrieving Banner data under specified groups. However, you can use AnQiCMS logic judgment tags in the template (such as{% if ... %}) to meet this advanced requirement. For example, after obtaining the Banner list, you can determine whether to display a specific Banner based on the role of the currently logged-in user, or combinenowLabel gets the current time, judges whether a certain activity banner is within the valid period before displaying it.This requires combining the Banner data with other system variables for judgment.