How to set up independent Banner images or thumbnails for document categories to be displayed on the front page?

Calendar 👁️ 79

In AnQiCMS, set an independent banner image or thumbnail for document categories, which can greatly enhance the visual appeal and user experience of the website, making each category have a unique brand identity.In fact, AnQiCMS provides very intuitive and flexible features in this aspect, you can easily make these custom images beautifully appear on the front page with just a few steps.

1. Configure exclusive visual elements for categories in the background

Firstly, we need to upload and set these unique images for your document category in the AnQiCMS backend.

  1. Enter document category management:Log in to the AnQiCMS backend, find "Content Management" in the left navigation bar, expand it, and select "Document Category".
  2. Select or create a category:In the document category list, you can select an existing category to edit, or click "Add Category" to create a new category.After entering the category editing page, you will see a detailed settings form.
  3. Upload Banner image:In the "Other Parameters" section of the category settings page, you will find the "Banner Image" option. This is where you set the exclusive top banner image for this category.
    • The banner image is usually used at the top of the category page, as an eye-catching background image, carousel image, or main visual image.
    • You can upload multiple images, the system will treat them as a set of slideshows.In order to maintain the aesthetic and consistency of the front-end display, it is strongly recommended that you upload images of the same size or proportional harmony.
  4. Upload thumbnail:Below the "Banner Image", you will see the "Thumbnail" option.
    • Thumbnail is usually a small preview image displayed in a list page, navigation menu, or content card, serving as a visual identifier.
    • It is not mandatory, but when it is necessary to display visual previews for classification (such as displaying popular category lists on the homepage), thumbnails can provide clear visual guidance and greatly enhance the user experience.
  5. Save settings:After completing the upload of the image and filling out any other category information, click the 'OK' or 'Save' button at the bottom of the page, your settings will take effect.

Through these simple background operations, you have already configured unique visual resources for the category. Next, we need to understand how to call these images in the template files of the website's frontend.

Second, template call: Let the custom image shine on the front page

After setting up the images in the background, the next step is to display them on the front page.This requires us to use the specific tags provided by AnQiCMS in the template file.AnQiCMS' template tag system is powerful and flexible, it can easily realize both individual category pages and category lists.

1. Call the image on a single category page (for example, the detail page of an article category)

When you visit a specific category page, you can usecategoryDetailtags to get detailed information about the category, including the Banner image and thumbnail that we have just set up.

{# 假设这是您的分类详情模板文件,如 article/list.html 或 product/list.html #}

{# 获取当前分类的完整数据对象 #}
{% categoryDetail currentCategory %}

{# 显示分类的名称作为页面标题 #}
<h1>{{ currentCategory.Title }}</h1>

{# 显示分类的描述 #}
<p>{{ currentCategory.Description }}</p>

{# 调用分类的 Logo 图(通常是主图或大图) #}
{% if currentCategory.Logo %}
    <img src="{{ currentCategory.Logo }}" alt="{{ currentCategory.Title }} 主图" class="category-main-logo">
{% endif %}

{# 调用分类的 Banner 组图,可用于轮播、背景等场景 #}
{% if currentCategory.Images %}
    <div class="category-banner-slider">
        {% for image in currentCategory.Images %}
            <img src="{{ image }}" alt="{{ currentCategory.Title }} Banner-{{ forloop.Counter }}" class="slider-item">
        {% endfor %}
    </div>
{% endif %}

{# 调用分类的缩略图(通常是小图,如果 Logo 已作为大图,这里可能不显示) #}
{% if currentCategory.Thumb %}
    <img src="{{ currentCategory.Thumb }}" alt="{{ currentCategory.Title }} 缩略图" class="category-small-thumb">
{% endif %}

In the above code, we first obtained the article list through{% categoryDetail currentCategory %}Retrieved all data from the current category and assigned it tocurrentCategorythe variable. After that, you can use{{ currentCategory.Logo }}/{{ currentCategory.Images }}and{{ currentCategory.Thumb }}To retrieve and display the corresponding image address. To avoid the page displaying abnormally due to missing images, we also added{% if ... %}judgment, only when the image exists will the corresponding one be rendered<img>.

2. In the category list page, call images (for example: display multiple category cards on the homepage)

If you want to display multiple categories on a page (such as the category module on the homepage or the subcategory list under a parent category), and display thumbnails or Logos for each category, thencategoryListthe tag comes into play.

`twig {# Assume you are on the homepage or other aggregation pages, and you need to list multiple categories and display their thumbnails #} {# Here is an example of getting the top-level categories under the article model, and you can adjust moduleId and parentId according to your needs #} {% categoryList topCategories with moduleId=“1” parentId=“0” %}

{%

Related articles

How do the SEO title and keywords of the document category affect the search results display of the category page?

For website content operation, the category page is an important entry for users to discover and for search engines to crawl the website content.A meticulously optimized category page, which not only improves user experience but also significantly affects its performance in search engine results.In AnQiCMS (AnQiCMS), the SEO title and keywords of the document category are key factors affecting this performance.

2025-11-07

How does AnQi CMS handle documents that have not uploaded thumbnails, such as displaying default thumbnails?

In website content operation, the visual presentation of content is often the key to attracting readers' attention, and thumbnails play an indispensable role in it.Imagine when you publish a fantastic document but inadvertently forget to upload the thumbnail, resulting in blank or broken icons on the page, which undoubtedly affects the user experience and the professional image of the website.How does AnQiCMS (AnQiCMS) cleverly deal with this situation to ensure that the website always maintains good visual consistency?

2025-11-07

How to set up a timed publishing feature to control the online display time of documents?

In content operation, the timing of content release is often a key factor in determining its communication effect.In order to seize specific marketing opportunities, maintain the rhythm of daily updates, or prepare holiday content in advance, a flexible scheduling publication feature can greatly enhance operational efficiency.AnQiCMS (AnQiCMS) knows this well and has specially provided a powerful scheduled publishing function to allow you to easily plan the content release time and achieve automated operation.This feature is designed to help you reduce cumbersome manual operations, making content operation more strategic and automated.

2025-11-07

How does the custom URL feature affect the display links of documents and categories on the front page?

When operating a website, the structure and readability of links play a crucial role.A clear and friendly URL not only improves the user experience but is also an indispensable part of search engine optimization (SEO) strategy.Anqi CMS is well-versed in this, providing powerful custom URL functions that allow you to flexibly shape the display links of documents and categories on the front page. ### The Core Value and Function of Custom URL The custom URL feature allows us to convert traditional dynamic links composed of IDs into more descriptive and meaningful static or pseudo-static links.

2025-11-07

How do custom fields in the Anqi CMS content model affect the display of document detail pages?

In AnQiCMS, the content model and custom fields are the core functions to enhance the flexibility and diversity of website content management.They make the website no longer confined to the traditional 'title + text' mode, but able to display more personalized and structured information according to different business needs.How do these carefully configured custom fields in the background affect the display of our website's document detail page?

2025-11-07

How can you filter and display documents of specific content models in the document list?

In website operation, efficiently managing and displaying different types of content is the key to improving user experience and work efficiency.AnQiCMS (AnQiCMS) with its flexible content model design allows you to easily handle various content formats, whether it is articles, product details, or event announcements, and can be managed and displayed in a fine-grained manner. Today, let's delve deeper into how to efficiently filter and display documents of specific content models in AnQiCMS.This can not only help you quickly locate the content you need in the background, but also make the front-end content of your website more accurate and dynamic.

2025-11-07

What impact does the document recycling station function have on users viewing content on the front end?

In daily website operations, operations such as adding, deleting, modifying, and querying content are very common.However, the action of 'deleting' is often accompanied by a hint of hesitation and risk.Our CMS is well-versed in this, providing users with a document recycle bin feature, which is not just a simple 'trash can', but also an important guarantee for your content security and front-end display effect.When you perform a deletion operation on a document, a product detail, or any other entry under any content model in the Anqi CMS backend management system, the most direct impact is that it will immediately disappear from your website's front end.

2025-11-07

How to use Markdown editor to display mathematical formulas and flowcharts in AnQi CMS?

In website operation, we often need to display some content containing mathematical formulas or complex flow charts, which not only makes information delivery more accurate, but also greatly enhances the professionalism and readability of the article.AnQi CMS knows this need, and for this reason, it has built-in support for Markdown editors and combined with external libraries, allowing us to easily present these professional contents in articles.

2025-11-07