How to display custom Banner image and content in AnQiCMS single page?

Calendar 👁️ 63

In website operation, a well-designed single page often plays a vital role in brand display, product introduction, or promotion of specific activities.An eye-catching banner area that can quickly grab visitors' attention and convey key information.AnQiCMS as a flexible content management system provides a very convenient way for you to easily set up and display custom banner images and content on a single page.

Next, we will explore together how to implement this feature in AnQiCMS.

Step 1: Upload Banner image for the single page in the background.

AnQiCMS provides an intuitive interface for managing your static pages. To set a banner for a single page, you need to log in to the backend first.

  1. Enter Page Management:After logging into the AnQiCMS backend, you will see the menu item 'Page Resources' in the left navigation bar, click on it, and then select 'Page Management'.Here is a list of all the single pages on your website.
  2. Select or create a single page:You can choose to edit an existing single page, such as "About Us" or "Contact Information", or click "Add Single Page" to create a new page.
  3. Upload Banner image:In the editing interface of a single page, scroll down and you will find a section named "Banner image".In here, you can click the upload button to select the banner image you have prepared.
    • You can upload a single image as the fixed banner of the page.
    • If your design requires a carousel effect, AnQiCMS also supports you uploading multiple images.The system will manage them as a group of banner images, convenient for you to call in the frontend template.
    • To ensure a unified and beautiful visual effect, it is recommended that you upload images with consistent size and proportion.

After the image upload is complete, remember to click the "OK" or "Save" button at the bottom of the page to save your changes to the system.

Second step: Design or modify the single-page template to display the Banner

After setting up the Banner image on the back-end, we need to inform AnQiCMS how to display them in the front-end template. AnQiCMS's template files are usually located/templateIn the directory. The default template path for a single page is usuallypage/detail.htmlBut you can also specify a custom template for a specific page.

We will mainly usepageDetailTag to retrieve image data from a single page. This tag is very flexible and can capture all relevant information on the page.

1. Display a single Banner image

If you only want to display the first Banner image you uploaded and make it the main visual element of the page, you can do this:

{%- pageDetail bannerImages with name="Images" %}
{%- if bannerImages %}
{%- set pageBanner = bannerImages[0] %}
<div class="page-banner" style="background-image: url('{{ pageBanner }}'); background-size: cover; background-position: center;">
    {# 您可以在这里叠加页面标题、简介等内容 #}
    <div class="container">
        <h1>{% pageDetail with name="Title" %}</h1>
        <p>{% pageDetail with name="Description" %}</p>
    </div>
</div>
{%- endif %}

This code first uses{% pageDetail bannerImages with name="Images" %}Get the list of all banner images associated with a single page.bannerImagesIt will be an array containing all image URLs. Next,{% set pageBanner = bannerImages[0] %}Get the URL of the first image in the list and apply it as a background image to andivelement. This way, you can be in thisdivInternally, freely overlay the title, description, and other text content of the page.

2. Display multiple Banner images (basic implementation of carousel)

If you upload multiple Banner images and want to implement a carousel effect on the front end, AnQiCMS will provide you with all the image URLs.You need to combine the front-end JavaScript carousel libraries (such as Swiper, Owl Carousel, etc.) to drive them.How to display all images and output them:

{%- pageDetail pageImages with name="Images" %}
{%- if pageImages %}
<div class="swiper-container mySwiper"> {# 假设您使用了Swiper轮播库 #}
  <div class="swiper-wrapper">
    {%- for item in pageImages %}
    <div class="swiper-slide">
      <img src="{{ item }}" alt="{% pageDetail with name="Title" %} Banner {{ forloop.Counter }}" />
    </div>
    {%- endfor %}
  </div>
  {# 添加分页器和导航按钮,需要根据您选择的轮播库文档进行配置 #}
  <div class="swiper-pagination"></div>
  <div class="swiper-button-next"></div>
  <div class="swiper-button-prev"></div>
</div>
{# 别忘了引入Swiper的JS和CSS文件,并初始化Swiper实例 #}
<script>
    var swiper = new Swiper(".mySwiper", {
        loop: true,
        pagination: {
            el: ".swiper-pagination",
            clickable: true,
        },
        navigation: {
            nextEl: ".swiper-button-next",
            prevEl: ".swiper-button-prev",
        },
    });
</script>
{%- endif %}

Here, we use a loop.pageImagesAn array, each image will be output as a carousel item. The specific front-end carousel logic (such as autoplay, indicators, navigation buttons, etc.) needs to rely on the third-party JavaScript library you choose to implement.

Step 3: Combine other content to enhance the Banner area

In addition to simple image display, it is usually desirable to overlay some text information in the Banner area to achieve better visual effects and information communication efficiency.

  • Page title and description:Page title ({% pageDetail with name="Title" %}) and summary ({% pageDetail with name="Description" %}) are the most common overlay elements. They can be directly throughpageDetailLabel retrieval.
  • Custom field:If your single-page model defines other custom fields (such as "Banner Subtitle", "Call-to-Action Button Text", etc.), you can also use similar{% pageDetail with name="您的自定义字段名" %}The way to obtain and display. These custom fields can be set in the "Other Parameters" section when editing the single page in the background.
  • Safe output:It is worth noting that all text content originating from the backend rich text editor, in order to ensure safety and proper display of HTML format, usually needs to be added during output|safeFilter. For example,{{ pageContent|safe }}.

By using these flexible configurations and template calls, AnQiCMS allows you to easily create a single

Related articles

How to batch update display text and links for the 'Full Site Content Replacement' feature of AnQiCMS?

The "Full Site Content Replacement" feature of AnQiCMS: an efficient tool for batch updating website text and links Content updates and maintenance are an indispensable part of daily website operations.It is undoubtedly time-consuming and labor-intensive to manually modify a massive amount of content, whether it is to adapt to a new content strategy, optimize search engine rankings, or simply correct a spelling error or update a broken link.Fortunately, AnQiCMS provides a powerful feature named "Site-wide Content Replacement" which can help users complete these tasks in bulk and efficiently, greatly improving operational efficiency

2025-11-08

How to build a multi-level dropdown menu and display the navigation list tags in AnQiCMS?

The website navigation serves as the core entry point for users to explore the website's content, and its structural design directly affects user experience and information acquisition efficiency.Especially multi-level dropdown menus can effectively organize a large amount of information, making the website structure clearer and more hierarchical.In Anqi CMS, building and displaying such a multi-level navigation system is flexible and intuitive. To successfully build a multi-level dropdown menu, we need to combine the backend navigation configuration with the tag call of the frontend template.### Step one: Understand the data structure of the Anqi CMS navigation list and the background configuration In Anqi CMS

2025-11-08

How to display the website's Logo, filing number and copyright information in AnQiCMS templates?

When building a professional website, some basic and important information is also indispensable, such as the website logo, filing number, and copyright statement.These elements not only help enhance the professional image and user trust of the website, but are also crucial for complying with specific regional regulations (especially the record-keeping requirements of Mainland China).In AnQiCMS (AnQiCMS), you can easily display this information in website templates through concise template tags.AnQiCMS uses a template engine syntax similar to Django, making the writing of template files intuitive and efficient

2025-11-08

How to batch regenerate thumbnails for AnQiCMS to adapt to new display sizes or formats (such as WebP)?

In website operation, images are indispensable elements to attract visitors and convey information, while thumbnails play a key role in enhancing the beauty of the page and loading efficiency in scenarios such as content lists and article recommendations.But as website design evolves, the diversity of display devices increases, and the demand for performance optimization continues to rise, the original thumbnail size or format may no longer be applicable.For example, to improve the loading speed of the website, convert all images to a more efficient WebP format, or to adapt to the new responsive layout, adjust the thumbnail display size may be required.face this situation

2025-11-08

How does AnQiCMS ensure that mathematical formulas and flowcharts inserted in the Markdown editor are displayed normally on the front end?

In modern website content creation, Markdown is favored by a large number of content creators for its concise and efficient features.However, for websites that need to present complex information, such as mathematical formulas and flowcharts, how to seamlessly insert them into Markdown editors and ensure they are displayed normally on the front end is often a challenge for content operators.AnQiCMS (AnQiCMS) fully understands this need, through flexible configuration and standardized introduction methods, allowing these complex elements to be elegantly presented on your website

2025-11-08

How to use AnQiCMS filter to perform string truncation, case conversion, and other processing on displayed content?

When using AnQiCMS for website content management, we often encounter situations where we need to make some fine adjustments to the displayed content, such as when a title of an article is too long and we want it to be displayed partially with an ellipsis at the end;Or some text should be displayed in uppercase or lowercase. The powerful template filter function of AnQiCMS can easily help us meet these needs without modifying any backend code, and it can be completed directly at the template level.The template filter is a practical tool in AnQiCMS template language, which allows us to transform the values of template variables

2025-11-08

How to automatically parse URL strings in HTML code to display clickable links in AnQiCMS?

In the daily operation of websites, we often need to insert various URLs in the article content, whether it is to refer to external resources or to guide users to visit other pages within the site.If adding the `<a>` tag manually to these URLs each time is time-consuming and prone to errors.It is fortunate that AnQiCMS provides users with a very intelligent and convenient solution in this regard, which can automatically identify and parse URL strings in HTML code and convert them into clickable links.### Core Mechanism: Make the URLs in the content "alive" When you edit articles in the AnQiCMS backend

2025-11-08

How to generate random text in AnQiCMS template as placeholder content for development testing display?

During the development of AnQiCMS templates, we often need to fill in placeholder text on the page before the real content is ready, in order to better observe the layout, test the style and function.Manually entering "test content" or placeholder text is time-consuming and lacks authenticity.Fortunately, AnQiCMS provides a very convenient built-in tag that can elegantly solve this problem - that is the `lorem` tag.### AnQiCMS is a random text generator tool: `lorem` tag `lorem`

2025-11-08