How to add a 'Learn More' button to the home page Banner?

Calendar 👁️ 65

In website operation, the homepage banner (banner ad) plays a crucial role, it is the first area that visitors see when entering the website, responsible for conveying core information and attracting users' attention.And a well-designed, guiding "Learn More" button is even more effective in enhancing user interaction, converting visitors into potential customers or subscribers.As an experienced user of AnQiCMS, I am well aware of its powerful and flexible content management capabilities.Today, let's delve into how to巧妙地添加a "Learn More" button on the home page banner of an AnQiCMS-driven website to make your site more guiding.

Home Banner: The first impression and guide entry of the website

In AnQiCMS, the management and invocation of the homepage Banner are usually realized through its built-in template tags, which makes the display and layout of content highly flexible.A typical Banner not only includes eye-catching images, but usually also accompanied by a title, a brief description, and most importantly, a link to detailed content.Our goal is to utilize these existing elements, or slightly expand them, to build a fully functional "Learn More" button.

AnQiCMS providesbannerListThe tag used to retrieve the data for the home page banner. Through this tag, you can easily obtain the image address of each banner (Logo), related link (Link),Title(Title), description (Description)and key information. This information is the basis for building the “Learn More” button.

Detailed steps to add a 'Learn More' button to the homepage banner

Add a 'Learn More' button to the AnQiCMS homepage banner, we mainly need to focus on two aspects: the background content configuration and the front-end template code editing.

The first step is to understand the Banner data structure and backend configuration

Although the AnQiCMS documentation does not list the independent module of "Home Banner Management", butbannerListThe powerful function of the tag means that you can configure these Banners in some way in the background.Generally, you can upload Banner images under 'Page Resources' in 'Image Resource Management', and associate images, links, titles, and descriptions in 'Content Management' or 'Single Page Management' to display as the home page Banner content.

Core field:Each one passingbannerListBanner item called by the tag (item) includes the following fields, which are the key to implementing the button:

  • item.Logo: The address of the Banner image.
  • item.LinkClick the banner or button to go to the link.
  • item.TitleBanner title text.
  • item.DescriptionBanner description text.

These fields can be set in the corresponding Banner content editing page in the background.For example, when editing a Banner, you can enter the URL of the target page in the 'Link' field, and enter the text content of the Banner in the 'Title' and 'Description' fields.

Step two: Edit the homepage template file, build the button

Next, we need to edit the homepage template file of the website. According to the AnQiCMS template convention, the homepage template is usually located/template/你的模板目录/belowindex.htmlorindex/index.html.

Open your home page template file, find the code block that calls the Banner list. You will see a structure similar to the following.bannerListTags:

{% bannerList banners %}
    {% for item in banners %}
    <div class="your-banner-container">
        <a href="{{item.Link}}" target="_blank">
            <img src="{{item.Logo}}" alt="{{item.Alt}}" class="banner-image" />
        </a>
        <div class="banner-text-area">
            <h3>{{item.Title}}</h3>
            <p>{{item.Description}}</p>
            {# 在这里添加我们的“了解更多”按钮 #}
        </div>
    </div>
    {% endfor %}
{% endbannerList %}

Now, we will be usingbanner-text-areaAdd the 'Learn More' button HTML code in the area. A button is actually a hyperlink with a specific style.<a>tags).

Add button code example:

{% bannerList banners %}
    {% for item in banners %}
    <div class="your-banner-container">
        <a href="{{item.Link}}" target="_blank" class="banner-link-area"> {# 也可以让整个Banner可点击 #}
            <img src="{{item.Logo}}" alt="{{item.Alt}}" class="banner-image" />
        </a>
        <div class="banner-text-area">
            <h3>{{item.Title}}</h3>
            <p>{{item.Description}}</p>
            {% if item.Link %} {# 仅当Banner配置了链接时才显示按钮 #}
                <a href="{{item.Link}}" class="btn-learn-more" target="_blank">
                    了解更多
                </a>
            {% endif %}
        </div>
    </div>
    {% endfor %}
{% endbannerList %}

In this code block:

  • {% if item.Link %}This line is very important, it ensures that the "Learn More" button will only be displayed when the background is configured with an actual link for the Banner.This avoids the embarrassing situation where a button appears but has nowhere to jump.
  • <a href="{{item.Link}}" class="btn-learn-more" target="_blank">了解更多</a>This line is the core of the button.
    • href="{{item.Link}}": Dynamically obtain the link address configured by the background.
    • class="btn-learn-more": This is a custom CSS class name used to add styles to the button later.
    • target="_blank": Typically opens links in a new tab, enhancing user experience.
    • 了解更多: This is the text displayed on the button, you can modify it according to your actual needs, such as 'Buy Now', 'View Details', etc.

Step 3: Button Style Enhancement

After adding the HTML structure, the button may look plain. To make it match the overall style of the website and be attractive, we need to beautify it with CSS.

In the CSS file corresponding to your template (usually located/public/static/css/in the directory, and in the<head>section reference) of the template, you can add style rules for the.btn-learn-moreclass:

`css /* Example CSS style */

Related articles

Will the data of the `bannerList` tag be cached? How to clear the Banner cache?

As an experienced website operations expert, I am well aware of the importance of balancing the real-time nature and high performance of website content.In AnQiCMS (AnQiCMS) such an efficient content management system, we make full use of its powerful template functions and caching mechanism to optimize the website's access experience.Today, let's delve deeply into a common operational issue: whether the data of the `bannerList` tag will be cached?And when we need to update the Banner, how to effectively clear these caches.

2025-11-06

How to enable or disable the image watermark function of the home page Banner?

As an experienced website operation expert, I am well aware of the importance of the homepage banner image in brand image and user experience.It is not only the 'front door' of the website, carrying the heavy responsibility of visual impact and information delivery, but also the copyright protection of its images should not be overlooked.Today, let's delve deeply into the enable and disable of the homepage Banner image watermark function in AnQiCMS (AnQiCMS), to help everyone better utilize this feature and protect their original content.--- ## Guard Your "Facade"

2025-11-06

How to implement the Banner image carousel effect in Anqi CMS template?

As an experienced website operations expert, I am happy to provide you with a detailed explanation of how to implement the banner image carousel effect in AnQiCMS (AnQiCMS) templates.AnQi CMS, with its flexible template mechanism and powerful content management capabilities, provides an excellent foundation for us to implement such functions.--- ## In AnQiCMS Template, Implement the Banner Image Carousel Effect Guide In today's web design, the Banner image carousel (Carousel) is almost a standard feature for every corporate website, portal website

2025-11-06

Does the `bannerList` tag support displaying different Banners based on user permissions?

In website operation, how to provide customized content experience according to different user groups has always been the key to improving user stickiness and conversion rate.For Banner elements with strong visual impact and direct information delivery, the need for differentiated display is particularly common.As an experienced user and operations expert of AnQiCMS, I will discuss whether the `bannerList` tag supports displaying different Banners based on user permissions?This topic, combined with the functional features of AnQiCMS, is deeply analyzed for everyone.### One

2025-11-06

Can the `bannerList` tag directly call images of articles or products as banners?

As an experienced website operations expert, I am well aware of the importance of content display flexibility in the efficiency of website operations.AnQiCMS (AnQiCMS) relies on its powerful content model and flexible tag system to provide us with great convenience.Today, let's delve deeply into a topic that many people often care about: Can the `bannerList` tag directly call the images of articles or products as banners?In AnQiCMS, content management and display have a clear and flexible design philosophy

2025-11-06

How is the `bannerList` tag used differently in the mobile template of AnQiCMS?

Hello, everyone at Anqi CMS operations, colleagues, and technical partners!As an experienced website operations expert, I know that in the current mobile Internet era, the performance of a website's mobile end is directly related to user experience and marketing effect.Today, let's delve into a seemingly basic but actually promising tag in Anqi CMS, `bannerList`, and how its usage and strategy differ in mobile templates.First, let's review the basic appearance of the `bannerList` tag in AnQi CMS.Based on AnQiCMS template tags document

2025-11-06

How can the breadcrumb navigation tag be used correctly in AnQiCMS?

As an experienced website operations expert, I am well aware that every detail of a website is crucial in terms of user experience and search engine optimization (SEO).A breadcrumb navigation is just such a seemingly minor element that can have a significant impact on the overall performance of a website.It can not only help users clearly understand their position on the website, but also provide important clues about the website structure to search engines.AnQiCMS as an efficient and customizable enterprise-level content management system

2025-11-06

What is the basic syntax for calling the breadcrumb navigation tag in the AnQiCMS template?

Hello, as an experienced website operations expert, I know that every detail of a website is related to user experience and search engine optimization.Breadcrumb Navigation is a design element that seems small but is actually of great significance.It not only clearly tells the user their current location, effectively improves website usability, but also optimizes the website structure, helping SEO.Today, let's delve deeply into how to flexibly use the breadcrumb navigation tags in the AnQiCMS template, making the path of your website clear at a glance.### Core Grammar

2025-11-06