How to manage and display category Banner images and thumbnails?

Calendar 👁️ 74

In website operation, the category page is an important link to guide users to browse and deepen the brand impression.Configure a unique Banner image and thumbnail for the category page, which not only enhances the visual appeal of the website but also allows users to understand the category content more intuitively, effectively optimizing the user experience.Our company's CMS provides flexible and easy-to-use features in this aspect, helping us manage and display these visual elements efficiently.


One, efficiently manage the Banner images and thumbnails of categories

Managing the Banner image and thumbnail of the category is the first step in visualizing website content. The Anqi CMS backend design makes this process very intuitive.

When we enter the AnQi CMS backend management interface and navigate to the "Document Classification" module under "Content Management", we can start editing and setting the classification in detail.Whether it is to create a new category or edit an existing category, we will find a special area in the category editing form for uploading and setting the "Banner image" and "thumbnail".

  1. Set Banner Image:The banner image is usually used at the top of the category page to display the theme or features of the category in a large image, creating a visual impact.Our company's Anqi CMS allows us to upload multiple Banner images for each category.This means we can design a carousel to be displayed at the top of the category page, bringing users a richer visual experience.When uploading, the system usually prompts us to select an image, we can upload a new image from the local, or directly choose from the existing image resource library on the website.A practical suggestion is to maintain the same size ratio of the uploaded Banner image to ensure uniformity of visual effects and loading performance.

  2. Set Thumbnail:Category thumbnails are small representative images, not all categories need to be set, but for scenarios where category information needs to be displayed in a small image form in category lists, navigation menus, or other modules, the role of thumbnails is particularly important.For example, when displaying popular categories on the homepage of a website, a well-designed thumbnail can quickly attract the attention of users.We can upload or select an appropriate thumbnail for each category based on the actual front-end display requirements.

It is worth mentioning that all images uploaded through the backend will be uniformly collected under the "Page Resources" section under "Image Resource Management", which is convenient for us to carry out centralized management, classification, and reuse.In addition, to enhance website loading speed and user experience, AnQi CMS provides optimization options such as 'Whether to automatically compress large images', 'thumbnail processing method', and 'whether to enable Webp image format' under 'Background Settings' -> 'Content Settings', properly configuring these functions can effectively manage and optimize the website's image resources.


II. Flexible Display of Banner Images and Thumbnails for Categories

After setting up the Banner image and thumbnail for the category in the background, how to present it on the website front-end through template tags is the key to achieving the visual design effect.AnQi CMS provides a simple and powerful template tag, making this process flexible and controllable.

  1. Display on Category Details Page (using)categoryDetailTag):When a user enters a specific category page, we may need to display a large banner image and detailed information for that category. At this point,categoryDetailLabels are our first choice.It can retrieve all detailed data for the current or specified category, including the Logo (usually used for large images), Thumb (thumbnail), and Images (Banner group images).

    • Display category logo (large image):

      {# 获取当前分类的大图Logo #}
      <img src="{% categoryDetail with name="Logo" %}" alt="{% categoryDetail with name="Title" %}" />
      
      {# 获取指定ID分类的大图Logo #}
      <img src="{% categoryDetail with name="Logo" id="1" %}" alt="{% categoryDetail with name="Title" id="1" %}" />
      
    • Display category thumbnail:

      {# 获取当前分类的缩略图 #}
      <img src="{% categoryDetail with name="Thumb" %}" alt="{% categoryDetail with name="Title" %}" />
      
      {# 获取指定ID分类的缩略图 #}
      <img src="{% categoryDetail with name="Thumb" id="1" %}" alt="{% categoryDetail with name="Title" id="1" %}" />
      
    • Display category Banner group image (multiple images):If the category is set with multiple Banner images, we need to combineforLoop to traverse and display them. These images can be designed as a slideshow or other multi-image display format.

      {% categoryDetail categoryImages with name="Images" %}
      {% if categoryImages %} {# 判断是否有Banner图存在 #}
      <div class="category-banner-slider">
          {% for item in categoryImages %}
          <img src="{{ item }}" alt="{% categoryDetail with name="Title" %}" />
          {% endfor %}
      </div>
      {% endif %}
      

      Sometimes we may only need the first Banner image as a fixed background, and it can be obtained like this:

      {% categoryDetail bannerImages with name="Images" %}
      {% if bannerImages %}
      {% set pageBanner = bannerImages[0] %} {# 获取第一张Banner图 #}
      <div class="page-header" style="background-image: url('{{ pageBanner }}');">
          <h1>{% categoryDetail with name="Title" %}</h1>
      </div>
      {% endif %}
      
  2. Display on the category list page (usingcategoryListTag):In the navigation menu of the website, in the recommendation module, or in any list area displaying multiple categories, we often need to display a thumbnail or small logo for each category.categoryListThe label helps us get the list of child categories under a specified model or parent category, and access each category's Logo or thumbnail in a loop.

    {% categoryList categories with moduleId="1" parentId="0" %} {# 获取文章模型下的顶级分类 #}
    <ul class="category-overview-list">
        {% for item in categories %}
        <li>
            <a href="{{ item.Link }}">
                {# 显示分类的缩略图,例如用于卡片式列表 #}
                {% if item.Thumb %}
                <img src="{{ item.Thumb }}" alt="{{ item.Title }}" />
                {% else %}
                <img src="{% system with name="SiteLogo" %}" alt="{{ item.Title }}" /> {# 如果没有缩略图,显示网站Logo作为备用 #}
                {% endif %}
                <h3>{{ item.Title }}</h3>
                <p>{{ item.Description|truncatechars:50 }}</p>
            </a>
        </li>
        {% endfor %}
    </ul>
    {% endcategoryList %}
    

By using the above management and display methods, we can fully utilize the functions provided by Anqi CMS to create unique and user-friendly visual presentations for the various category pages of the website, which is undoubtedly of great significance for enhancing the professionalism and user stickiness of the website.


Frequently Asked Questions (FAQ)

  1. Q: Why did I upload a category banner image but it did not display on the website front page?A: This is usually because the Banner image tag is not properly called in the template. Please check the template file you are using (for example{模型table}/list.htmlor{模型table}/detail.htmletc

Related articles

How to dynamically filter and display a list of articles through URL parameters or search keywords?

Today, with the increasing refinement of content management, how to make your website content smarter and more considerate in serving visitors is the key to improving user experience and website value.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that provides powerful functions to help us achieve this, especially in terms of dynamic filtering and displaying article lists. The combination of template tags with URL parameters allows for easy construction of highly customizable content presentation methods.This article will give a detailed introduction on how to use URL parameters and search keywords

2025-11-09

How to embed and display a留言验证码in a front-end form?

In website operation, the message board and comment area are often important channels for interaction with users.However, the garbage information and malicious submissions that follow are also a headache.An effective method of integrating captcha functionality to filter out this noise.Today, let's talk about how to easily embed and display a message captcha in the frontend form of AnQiCMS (AnQiCMS), building a defense line for your website.

2025-11-09

How to convert multi-line text content into HTML format using a newline character?

In content management, we often encounter situations where we need to enter multiline text, such as product details, service introductions, company profiles, or contact information.This content is typically segmented by pressing the Enter key during backend editing.However, when this content is directly presented on the website front end, you may find that it is 'squeezed' together, with all line breaks disappearing, which not only affects the reading experience but also makes the page look disorganized.AnQi CMS as an efficient enterprise-level content management system, of course, has considered this point and provided a variety of elegant solutions

2025-11-09

How to dynamically obtain and display the current year in the template?

In website operation, it is crucial to maintain the timeliness and accuracy of content, especially information like copyright year, which, if manually updated, is not only cumbersome but also prone to omission.Our company AnQi CMS provides a very convenient way to dynamically obtain and display the current year in templates, ensuring the latest information on the website.

2025-11-09

How to display both subcategories and the list of articles under the category on a category page?

When operating the AnQiCMS website, we often encounter such a need: on a category page, we not only want to display the list of articles under the category but also clearly list all its subcategories to facilitate users in making more detailed navigation.The Anqi CMS, with its flexible template engine and rich built-in tags, can fully help us easily achieve this goal. ### Understanding AnQi CMS Category Page and Template Mechanism In AnQi CMS, each category (whether it is an article category or a product category) can be associated with an independent template file. Generally speaking

2025-11-09

How to correctly display HTML rich text content in article content using the `safe` filter?

In website content operation, rich text content plays a vital role.It allows us to enrich the expression of the article with various formats such as images, links, bold, italic, and more, enhancing the reading experience.AnQiCMS (AnQiCMS) provides a powerful backend editor, making it easy for us to create various wonderful content.However, when this rich text content is finally displayed on a website page, sometimes you may find that the original beautiful formatting and links have become raw HTML code strings. Why is that?

2025-11-09

How to use filters in a template to format displayed numbers and strings (such as decimal places, case conversion)?

In website content presentation, the aesthetics and readability of the data are as important as the quality of the content itself.AnQiCMS (AnQiCMS) provides powerful filter (Filters) functions at the template level, allowing us to easily format numbers and strings displayed on the page, thereby enhancing user experience and the professionalism of page information. ### Filter: A process in data processing We can imagine a filter as a series of processes that handle data.Raw data is like unprocessed raw materials, after the processing of the filter, it can be shaped into what we need

2025-11-09

How to add special styles to specific items when displaying in a list, based on the count in a for loop?

In website content display, we often need to highlight specific items in the list visually, whether it is to attract the attention of users or to enhance the hierarchy of the content.For example, you may want to add a "pin" mark to the latest few articles published, or make the odd and even rows of the list display different background colors to enhance readability.AnQiCMS (AnQiCMS) flexible template engine, which provides powerful support for these refined controls.AnQiCMS's template system borrows the syntax of the Django template engine

2025-11-09