How to display detailed information of a specific category in AnQiCMS, including its introduction and Banner image?

Calendar 👁️ 62

In AnQiCMS, the category page is not just a simple list of content, but also an important part of the website's information architecture, as well as a key entry point for displaying specific themes to users and guiding them to delve deeper into browsing.A well-designed category page that not only enhances user experience but also effectively optimizes search engine rankings.This article will provide a detailed introduction on how to flexibly display the detailed information of a specific category in AnQiCMS, including its introduction and beautiful Banner image.

Back-end settings for category information

To display exclusive introductions and Banner images on the category page, you first need to make the corresponding settings in the AnQiCMS backend.Please log in to the backend management interface and then navigate to the 'Content Management' module under the 'Document Category' option.Here, you can edit or create a new category.

In the category editing page, you will find several key input boxes:

  • Category Name: This is the category title, which will be displayed directly on the website front end.
  • Category introduction: Here you can fill in a brief text to summarize the main content of this category.This introduction is usually used for displaying summaries on category list pages or as an opening introduction on category detail pages.It is also very important for search engine optimization (SEO), and can help search engines understand the core content of category pages.
  • Banner imageThis is an image upload area, you can upload one or more images for the current category.These images are usually used at the top of the category page, as a visual focus, enhancing the aesthetics and professionalism of the page.You can upload multiple images to achieve a carousel effect, or you can upload just one as a fixed Banner.

Make sure you have correctly filled in the 'Category Description' and uploaded the 'Banner Image' for the categories that need to be displayed in the background.This background data is the basis for the display on the front end.

The method called in the front-end template

After completing the background settings, next, we need to use the template tags provided by AnQiCMS in the website template to retrieve and display this information.AnQiCMS uses a syntax similar to the Django template engine, making data calls intuitive and easy to understand.

We mainly use in the category page templatecategoryDetailTags to get the detailed information of the category.

Display the category introduction

To display the category overview, you can use it in the template file.categoryDetailtags, and specifyname="Description"To get the category overview field value.

  • Get the current category overview:When you are on the details page of a category, AnQiCMS will automatically identify the current category, and you do not need to specify the category ID to directly obtain its introduction:
    
    <div class="category-description">
        {% categoryDetail with name="Description" %}
    </div>
    
  • Get the introduction of a specified category:If you need to display the introduction of a specific category on other pages (such as the homepage or navigation menu), you canidspecify the category ID with parameters:
    
    <div class="some-other-place-description">
        {% categoryDetail with name="Description" id="1" %} {# 这里的 "1" 替换为您的分类ID #}
    </div>
    

Display the category Banner image

Category banner images usually exist in the form of image groups, AnQiCMS usesImagesfields to store them. In the template, you need to retrieve this image group and iterate over it to display.

  • Display all Banner images (for carousel):If your category has uploaded multiple Banner images and you want them to be displayed in a carousel, you can write the template code like this:

    {% categoryDetail categoryBanners with name="Images" %}
    {% if categoryBanners %} {# 检查是否存在Banner图 #}
      <div class="category-banner-carousel">
        {% for imageUrl in categoryBanners %}
          <img src="{{ imageUrl }}" alt="分类Banner图 - {% categoryDetail with name='Title' %}" />
        {% endfor %}
      </div>
    {% endif %}
    

    This code will traversecategoryBannersAn array of image URLs, and generate a<img>Label. The CSS or JavaScript on the front end (if a carousel effect is needed) will implement the visual effects on this basis.altThe property settings help with SEO and improve the accessibility of images.

  • Only display the first Banner image:If the category has multiple Banner images, but you only want to display the first one, you can handle it like this:

    {% categoryDetail categoryBanners with name="Images" %}
    {% if categoryBanners %} {# 再次检查是否存在Banner图 #}
      {% set firstBannerUrl = categoryBanners[0] %} {# 获取数组的第一个元素 #}
      <img src="{{ firstBannerUrl }}" alt="分类Banner图 - {% categoryDetail with name='Title' %}" />
    {% endif %}
    

    Here we usesetThe tag defines a temporary variablefirstBannerUrlto store the URL of the first image.

  • Consider using Logo or Thumb as Banner (if only one):If your category usually only has one representative image as a Banner, and this image is also set in the background fields such as "Category Thumbnail Large Image (Logo)" or "Category Thumbnail (Thumb)", then directly calling these fields will be more concise:

    {# 如果Logo字段代表分类Banner图 #}
    {% categoryDetail categoryLogo with name="Logo" %}
    {% if categoryLogo %}
      <img src="{{ categoryLogo }}" alt="分类Banner图 - {% categoryDetail with name='Title' %}" />
    {% endif %}
    

Template file placement and modification

These template codes are usually placed in the category list template file of your AnQiCMS theme directory. According to the AnQiCMS template conventions, the template files for category pages are generally:

  • General category list page: {分类模型}/list.htmlfor examplearticle/list.htmlorproduct/list.html)
  • Specific category list page: {分类模型}/list-{分类ID}.htmlfor examplearticle/list-10.htmlused for the article category with ID 10)

You can/templateFind the currently used theme folder in the directory, and then modify the correspondinglist.htmlFile.If a specific category needs an exclusive layout, you can also specify a custom template file for it in the backend editing page of that category, through the 'Other Parameters' option under 'Category Template'.

Practical suggestions and precautions

  • Image optimization:When uploading a banner image, it is recommended to compress and adjust the size of the image appropriately to ensure page loading speed.AnQiCMS also provides image compression features, which can be configured in the 'Content Settings'.
  • SEO friendly:In<img>Set meaningful tags in the labelaltText that is not only friendly to search engines, but also improves the user experience in imageless mode.
  • Front-end style:The above code is responsible for outputting HTML structure and data, you may also need to write CSS styles to beautify the Banner image, such as adjusting size, positioning, adding responsive layout, etc.
  • Cache Update:After each modification of the template file or backend content, it is recommended that you click on 'Update Cache' in the AnQiCMS backend to ensure that the latest content is displayed in the website front end in a timely manner.

By following these steps, you can flexibly and efficiently display the introduction and Banner image of a specific category in AnQiCMS, thereby enhancing the visual appeal and professionalism of the website's content presentation.


Frequently Asked Questions (FAQ)

1. Ask: I have set up a Banner image, but it does not display on the front page. How should I troubleshoot?Answer: First, make sure that the image has been uploaded and saved successfully in the background category editing page. Second, check whether the template file you are using has correctly called{% categoryDetail categoryBanners with name="Images" %}Such a label, and traversedcategoryBannersArray. Finally, don't forget to refresh your browser cache, or click on "Update Cache" in the AnQiCMS backend to ensure that the latest template code and data are effective.

2. Ask: Should I use the field to display only one category image as the cover?Imagesor not?LogoorThumb?Answer: It depends on your specific needs and backend setting habits. If the category has only one representative image and you have uploaded it to the "Category Thumbnail Large Image (Logo)") or "Category Thumbnail (Thumb)" field, then just call{% categoryDetail with name="Logo" %}or{% categoryDetail with name="Thumb" %}It will be more concise. If the image is uploaded to the "Banner Image" area (i.e.ImagesField), even if there is only one, it can also pass{% set firstBannerUrl = categoryBanners[0] %}the way to obtain.

3. Ask: What is the difference between category overview and category content, and where should they be used?Answer: Category overview (DescriptionA brief text that summarizes the core theme of the category, often used as a summary on category list pages, at the top of category pages, or as the page'smeta descriptionTag content, helpful for SEO. Categorization content(ContentThis can include more detailed and rich text information, such as mixed text and images, long articles, etc., which are usually displayed in the main content area of the category page, providing more comprehensive information.You can reasonably choose to use these two fields according to the page layout needs.

Related articles

How to display the category list in AnQiCMS and support multi-level nested display?

The website's category navigation is the foundation of user experience and information architecture.A clear and easy-to-navigate category list, especially one that can support multi-level nesting, can greatly improve the efficiency of users in finding information and optimize the search engine's understanding of the website structure.AnQiCMS provides powerful and flexible template tags to easily achieve this requirement. ### AnQiCMS Category Management Basics In the AnQiCMS backend, you can create and organize your website categories under the "Content Management" module and "Document Category".

2025-11-08

How to display the banner image list on AnQiCMS template?

The visual elements of a website are crucial for attracting visitors and conveying brand information, and the Banner image list is one of its core components.AnQiCMS as a powerful content management system provides a flexible way to display these banner images on your website template, whether it be for the homepage slideshow, category page feature images, or single-page promotional images, all can be easily realized through concise template tags.

2025-11-08

How to display the details and list of a custom single page in AnQiCMS?

In AnQiCMS, the Single Page (Page) feature provides the website with the powerful ability to display independent and fixed content, such as 'About Us', 'Contact Information', 'Company Profile', and other pages.These pages usually do not belong to a specific category, but exist independently, carrying important corporate information or brand stories.Efficiently create, manage, and flexibly display the details and lists of these single pages on the website, which is an indispensable part of content operation.

2025-11-08

How to configure and display the contact information of the AnQiCMS website, such as phone number, address, and social media?

The contact information of the website is crucial for establishing a connection and providing support to users.AnQiCMS (AnQiCMS) provides an intuitive and flexible way to manage and display this important information, whether it's phone numbers, addresses, or various social media platform links, all can be easily achieved. ### Configure the website contact information in the background To configure the website contact information, you can first log in to the Anqi CMS backend management interface.In the left navigation bar, find and click "Background Settings", then select "Contact Information Settings".Here is a collection of all the contact information you may need to display

2025-11-08

How to control the generation method and size of image thumbnails in AnQiCMS to optimize display effects?

AnQiCMS provides a powerful and flexible image processing mechanism in website content management, among which the generation method and size control of image thumbnails are key to optimizing the display effect of the website, enhancing user experience, and accelerating page loading speed.Through the various built-in functions of the system, we can easily manage the thumbnail images with fine precision, ensuring that the website images are presented in **status across different scenarios. ### Thumbnail Image: An Important Aspect of Website Optimization Images on a website are not just visual elements, but also carriers of content conveyance and user experience.

2025-11-08

How to display website visitor traffic statistics and spider crawling records in AnQiCMS?

In website operation, a deep understanding of visitor behavior and the activity track of search engine crawlers is crucial for optimizing website content, improving SEO effects, and enhancing user experience.AnQiCMS as a comprehensive content management system fully considers this point, providing users with convenient traffic statistics and web crawler capture record functions to help us more effectively analyze website performance.

2025-11-08

How to remove blank lines generated by logical tags in AnQiCMS to optimize page display?

In website operation and front-end development, the neatness of the HTML structure of the page plays an indispensable role in maintaining code readability, improving development efficiency, and optimizing page rendering in certain situations. When using AnQiCMS and similar content management systems for template development, we often encounter a common but easily overlooked problem: logical tags (such as conditional judgment `if`, loop `for`, etc.) may introduce extra blank lines during rendering, resulting in the generated HTML code being not aesthetically pleasing and even causing unexpected visual effects in some layouts with strict layout requirements.

2025-11-08

How does AnQiCMS handle user-uploaded image resources and ensure normal display on the front end?

In website operation, efficient management of image resources and smooth display are key to improving user experience, optimizing page loading speed, and protecting content copyright.AnQiCMS as a content management system focusing on providing a comprehensive and flexible solution for handling user-uploaded image resources and ensuring normal display on the front end.AnQiCMS first provides a convenient way for **uploading and centralized management** of image resources.

2025-11-08