How to display category introduction, Banner image and thumbnail on AnQiCMS category page?

Calendar 👁️ 67

In website operation, the category page is not only a collection of content, but also an important entry for users to understand the website structure and deeply explore specific topics.A well-designed, informative category page that can significantly improve user experience and search engine optimization (SEO) effects.AnQiCMS provides flexible features, allowing us to easily display category descriptions, Banner images, and thumbnails on the category page, making your website's category page look fresh.

Understand the category page and template structure of AnQiCMS

In AnQiCMS, each category has its corresponding display page, usually used to list all articles or products under the category.These pages' content and layout are controlled by the corresponding template files.

By default, the template files of the category page are usually located in the template folder you are currently using/{模型table}/list.htmlFor example, the article category may correspond toarticle/list.htmlFor example, the product category may correspond toproduct/list.htmlYou can also customize the template for a specific category ID, for examplearticle/list-10.htmlThis provides highly customized possibilities for different categories.AnQiCMS will automatically load and parse the correct template based on the current category being accessed, and provide you with relevant data for the current category.

Add rich information for categories in the background

To display the category introduction, Banner image, and thumbnail on the category page, the first step is to add this information for your category in the AnQiCMS backend.

You can go toContent management -> Document classificationFind the category you need to edit, click the 'Edit' button.In the category editing page, in addition to basic information such as "Category Name" and "Document Model", you will see a collapsible area for "Other Parameters".Expand this area, and you will find the following key fields:

  • Category introduction:This is a text box, where you can enter a brief introduction to the current category.This content not only helps users quickly understand the classification topics, but is also an important source for search engines to capture page descriptions (meta description).
  • Banner image:Here you can upload one or more images. It is usually used to display an eye-catching visual element at the top of the category page, enhancing the beauty and professionalism of the page.You can upload multiple images, and the system will treat them as a group of images.
  • Thumbnail:This is a separate image upload field. Thumbnails are usually used in category lists (such as the category modules displayed on the homepage) or in breadcrumbs navigation, to represent the current category in the form of a small image.

Make sure to fill in and upload these contents for your category, as this is the data basis for the frontend call.

Call and display information in the category template.

Once the various information of the classification is configured in the background, the next step is to call and display them in the front-end template file. We will mainly usecategoryDetailLabel to get the detailed data of the current category.

Display the category introduction

The category introduction is usually divided into two types: a brief overview and detailed rich text content.

If you fill in the brief text in the "Category Introduction" field in the background, you can use it in the templatename="Description"to retrieve and display:

<div class="category-description-short">
    <p>{% categoryDetail with name="Description" %}</p>
</div>

If you need to display more detailed category content on your category page, including rich text and even Markdown format, you can fill in the "Category Content" field in the background and display it in the template withname="Content"Call it. Since the "category content" may contain HTML tags, to ensure that the browser parses it correctly, we need to use|safeFilter:

<div class="category-full-content">
    {% categoryDetail categoryContent with name="Content" %}{{ categoryContent|safe }}
</div>

Display Banner Image

The banner image is usually one of the most eye-catching elements on the category page. The banner images uploaded on the backend can be accessed byname="Images"to get a list of images.

If your category only needs to display one main banner image, or if you have uploaded multiple but only want to take the first one, you can handle it like this:

{% categoryDetail bannerImages with name="Images" %}
{% if bannerImages %}
    {# 假设您只想显示上传的第一张Banner图 #}
    {% set mainBanner = bannerImages[0] %}
    <div class="category-banner" style="background-image: url('{{ mainBanner }}');">
        {# 您可以在Banner上叠加分类名称或其他信息 #}
        <h1>{% categoryDetail with name="Title" %}</h1>
    </div>
{% endif %}

If your category may have uploaded multiple banner images and you want to display them in a carousel format, you need to introduce a front-end carousel component (such as Swiper or Owl Carousel), then iteratebannerImagesArray:

{% categoryDetail bannerImages with name="Images" %}
{% if bannerImages %}
    <div class="category-carousel swiper-container">
        <div class="swiper-wrapper">
            {% for image in bannerImages %}
                <div class="swiper-slide">
                    <img src="{{ image }}" alt="{% categoryDetail with name="Title" %}" />
                </div>
            {% endfor %}
        </div>
        {# 如果需要,添加分页器和导航按钮 #}
        <div class="swiper-pagination"></div>
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
    </div>
{% endif %}

Display thumbnails

Category thumbnails are usually used to display in category lists or navigation. If you want to display the thumbnail of the current category in a small area of the page, you can usename="Thumb":

<div class="category-thumbnail-area">
    {% categoryDetail categoryThumb with name="Thumb" %}
    {% if categoryThumb %}
        <img src="{{ categoryThumb }}" alt="{% categoryDetail with name="Title" %}" />
    {% else %}
        {# 如果没有上传缩略图,可以显示一个默认占位图 #}
        <img src="/public/static/images/default-thumb.png" alt="{% categoryDetail with name="Title" %}" />
    {% endif %}
</div>

An example of building a richer category page

Below is an example of integrating the above elements into the category list pagearticle/list.htmlThe simplified example, you can expand it according to your design requirements:

”`twig {% extends ‘base.html’ %} {# Inherit your base template #}

{% block title %}

<title>{% tdk with name="Title" siteName=true %}</title>

{% endblock %}

{% block content %}

<div class="container">
    {# 分类 Banner 区域 #}
    {% categoryDetail bannerImages with name="Images" %}
    {% if bannerImages %}
        {% set mainBanner = bannerImages[0] %} {# 假设只显示第一张作为主Banner #}
        <div class="hero-banner" style="background-image: url('{{ mainBanner }}');">
            <h1 class="hero-title">{% categoryDetail with name="Title" %}</h1>
        </div>
    {% else %}
        <div class="hero-banner-placeholder">
            <h1 class="hero-title">{% categoryDetail with name="Title" %}</h1>
        </div>
    {% endif %}

    <div class="category-header">
        {# 分类缩略图,可选 #}
        {% categoryDetail categoryThumb with name="Thumb" %}
        {% if categoryThumb %}
            <div class="category-icon">
                <img src="{{ categoryThumb }}" alt="{% categoryDetail with name="Title" %}" />
            </div>
        {% endif %}

        {# 分类简介 #}
        <div class="category-intro">
            <p>{% categoryDetail with name="Description" %}</p>
        </div>
    </div>

    {# 详细分类内容,如果需要 #}
    {% categoryDetail categoryFullContent with name="Content" %}
    {% if categoryFullContent %}
        <div class="category-detail-content">
            {{ categoryFullContent|safe }}
        </div>
    {% endif %}

    <hr>

    {# 该分类下的文章列表 #}
    <div class="article-list">
        <h2>最新文章</h2>
        {% archiveList archives with type="page" limit="10" %}
            {% for item in archives %}
            <div class="article-item">
                <h3><a href="{{ item.Link }}">{{ item.Title }}</a></h3>
                <p>{{ item.Description }}</p>
                <small>发布日期: {{ stampToDate(item.CreatedTime, "2006-01-02") }} 阅读: {{ item.Views }}</small>
                {% if item.Thumb %}
                    <img src="{{ item.Thumb }}" alt="{{ item.Title }}" class="article-thumb" />
                {% endif %}
            </div>
            {% empty %}
            <p>该分类下暂无文章。</p>
            {% endfor %}
        {% endarchiveList %}

        {# 分页导航 #}
        <div class="pagination">
            {% pagination pages with show="5" %}
                <ul>
                    {% if pages.PrevPage %}<li class="page-item"><a href="{{pages.PrevPage.Link}}">上一页</a></li>{% endif %}
                    {% for page

Related articles

How to display AnQiCMS single-page content and related images?

In website operation, we often need to create some independent pages, such as "About UsThese pages contain relatively fixed content, do not belong to the conventional article or product list, AnQiCMS (AnQiCMS) classifies them as "single page" and provides a very convenient management and display method.Through this system, you can easily publish and update this content, while flexibly controlling their display styles and image presentation.

2025-11-07

How to display custom Banner images on AnQiCMS pages?

In website operation, skillfully using Banner images can not only beautify the page but also effectively convey information and guide user behavior.AnQiCMS as a flexible content management system, provides various ways to display customized Banner images, allowing you to configure them individually according to different pages and needs. ### Flexible Upload and Management of Banner Images Firstly, all images that are going to be used as banners need to be uploaded to the AnQiCMS media library.This is very simple, you can go to the 'Page Resources' menu in the backend

2025-11-07

How to use the pagination tags of AnQiCMS to control the display of list content?

In a content management system, how to effectively display a large amount of information without sacrificing user experience is always a question worth pondering.AnQiCMS provides a powerful and flexible pagination feature that allows website managers to finely control the display of list content, ensuring that the website is both beautiful and efficient.

2025-11-07

How to get and display the previous and next article links of AnQiCMS articles?

In website content operation, guiding users to smoothly browse related content is a key link to improving user experience and website depth.After a user finishes reading an article, if they can immediately see links to related or sequential previous and next articles, it will undoubtedly encourage them to continue exploring. This not only helps to reduce the bounce rate but also effectively improves the website's PV (page views) and SEO performance.AnQiCMS (AnQiCMS) is an efficient content management system that provides a very convenient way to implement this function.In AnQi CMS

2025-11-07

How to filter and display AnQiCMS document list according to category ID and recommendation attributes?

Manage website content in AnQiCMS, often need to display document lists according to different conditions.Whether you want to display the latest articles of a specific category on the homepage or highlight some recommended content in the sidebar, the system provides flexible tools to help us achieve this.Today, let's talk about how to cleverly use category ID and recommendation attributes to accurately filter and display the document list you want.

2025-11-07

How to control the display sorting and pagination of AnQiCMS comment list?

In AnQi CMS, efficiently managing and displaying website comments is crucial for enhancing user interaction and optimizing content experience.The display order and pagination settings of the comment list directly affect the user's experience when browsing comments.This article will give you a detailed explanation of how to accurately control the sorting and pagination of comments in AnQiCMS. ### Understanding the Comment List Template Structure Firstly, we need to clarify the position of the comment list in AnQiCMS.

2025-11-07

How to use AnQiCMS tags to display categories and documents in the navigation menu?

In AnQiCMS, the website's navigation menu is not only an important entry for users to explore content and understand the website structure, but it is also a key for search engines to crawl and understand the website's hierarchical relationships.Using the powerful template tag feature of AnQiCMS, we can easily display categories and documents dynamically in the navigation menu, thus building a beautiful and efficient website navigation. ### One, prepare the background work: build the navigation skeleton Before delving into the template code, we need to make some basic configurations in the AnQiCMS background.In fact, the data that the front-end tags can retrieve and display

2025-11-07

How to configure the page Title, Keywords, Description of AnQiCMS to optimize search engine display?

In website operation, making your content stand out in search engines is a key step to gaining traffic.And the page title (Title), keywords (Keywords), and description (Description), which we often call TDK, are important elements for communicating with search engines.AnQiCMS is a system focused on enterprise content management, fully aware of the value of TDK configuration for SEO, and therefore provides flexible and powerful functions to help us easily optimize the display of our website in search engines.### Why is TDK configuration so important

2025-11-07