How to use the `type` parameter to call the homepage Banner under a specific group in the Anqi CMS backend?
As an expert deeply familiar with website operation, I know the importance of the home page banner for the image and marketing promotion of the website.It is not only the visual focus, but also the key area for conveying core information and guiding user behavior.AnQiCMS provides high flexibility in Banner management, especially through itsbannerListLabel collaborationtypeParameter, let us accurately call the home page Banner under specific groups according to different operational needs. Today, let's delve into this practical feature.
Use cleverlytypeParameter: Unlock the mystery of the Banner group call on the Anqi CMS homepage
In today's fiercely competitive online environment, the website's homepage banner is like a showcase, the first line of attack to attract visitors' attention and convey core information.A well-designed, accurate Banner that can effectively improve user experience and promote conversion.AnQi CMS, as an efficient content management system, fully understands the importance of this need, and has therefore designed the Banner management function in detail.But how can we flexibly display specific groups of banners on the homepage accurately according to different scenarios, such as marketing activities, seasonal themes, etc.? This isbannerListwith the tag andtypeparameters are where they really shine.
Understand the Banner management mechanism of Anqi CMS
The AnQi CMS was designed with the diversity of website content and operational flexibility in mind.It allows you to create and manage multiple Banner groups in the background.This means you can prepare exclusive Banner sets for different marketing activities, product series, or page areas (such as the homepage slideshow, sidebar mini Banner, a specific festival promotion Banner, etc.).This grouping ability aims to help operators achieve more refined content placement, avoiding all banners mixed together and difficult to manage and schedule.
Core tool:bannerListwith the tag andtypeParameter
bannerListIs an Anqi CMS provided powerful template tag, specially used for calling the background configuration of the Banner image list on the front-end page. Its core lies in a namedtypeThe parameter. This parameter is the group name you set for Banner in the background, when you specify it in the templatetype="您的分组名"then,bannerListThe label will intelligently filter and only return all Banner image data under that group.
For example, if you create a banner group named "Home Large Image" in the background and upload some exquisite pictures, then when calling it in the template, you can write it like this:
{% 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>
</a>
{% endfor %}
{% endbannerList %}
If omittedtypeParameter, the system will default to calling the nameddefaultBanner under the group. This makes the call to Banner both highly customizable and maintain a certain default nature, very flexible.
In the above code,bannersIt is a variable name we define, used to store the banner list data obtained from the background. Throughforloop, we can iterate over each one in the list.item(i.e., each Banner object). Eachitemcontains a series of available fields, such as:
item.Id: The unique identifier ID of the Banner.item.Logo: The address of the Banner image, which is the most commonly used field.item.Link: Banner click after jump link address.item.Alt: Alternative text for Banner image, very important for SEO and accessibility.item.Title: Banner title, usually used for combination of images and text display or SEO assistance.item.Description: Description of the banner, which can be used for more detailed information display.
Practice step by step: How to call a specific group Banner in the template
Understood the principle, let's see the specific operation steps next:
Step 1: Set up Banner group in Anqi CMS backend
First, you need to go to the Banner management area in the Anqi CMS admin interface.Here, you can create or edit a Banner and specify a "group name".This group name is plain text, you can name it according to your actual needs, such as 'Home Carousel', 'Promotional Activities', 'New Product Recommendations', and so on.Make sure that the group name you set for a set of Banners you want to display in a specific area on the homepage is the same and easily recognizable; this is the basis for achieving precise calls.
Step 2: Identify the target group name
After setting up the group in the background, it is crucial to remember the exact name you have set for the group. For example, if you have set a group name as 'Home Carousel', then in the template,typeThe value of the parameter should be `