How to display the category thumbnail and name in the article list?

Calendar 👁️ 68

Anqi CMS: Display category thumbnails and names elegantly in the article list

In website operation, the article list page is an important entry point for users to browse content and discover information.A beautifully designed, informative list of articles can not only enhance user experience but also effectively guide users to delve deeper into reading.The traditional article list may only show titles, publication time, abstracts, and other information, making it somewhat monotonous.If a thumbnail and name of the category to which each article belongs can be displayed intuitively next to it, it will undoubtedly add more visual appeal to the website and help users quickly understand the content ownership, thereby improving the overall browsing efficiency and content reach rate.

The Anqi CMS with its flexible template system allows you to easily meet this requirement.We will introduce in detail how to display the thumbnail and name of the category of each article in the article list, making your website content more charming.

Why should category information be displayed in the article list?

Before we get our hands dirty, let's think about the benefits of doing so:

  1. Enhance visual appeal:Images are more eye-catching than text. Category thumbnails can make article list pages more lively and reduce visual fatigue.
  2. Improve content readability and organization:Users can quickly identify the field or theme of an article, helping them quickly filter the content they are interested in and improve the efficiency of information acquisition.
  3. Strengthen brand impression:If your category thumbnail design is unique, it helps to establish a clearer website or brand image in the minds of users.
  4. Optimizing user experience: Clear category identifiers can guide users to deeper browsing, such as clicking on category names or thumbnails to enter the exclusive page of the category.
  5. Indirectly assist SEO:Although it is not a direct SEO factor, a good user experience and longer page dwell time can send positive signals to search engines. At the same time, add appropriate to imagesaltThe attribute can also be indexed by search engines.

The core idea of AnQi CMS for displaying classified information.

In Anqi CMS, articles and categories are closely related.Each article belongs to a specific category, and each category can also have its own independent name, description, thumbnail, and other properties.Our goal is to display the list of articles by retrieving the thumbnail and name of the corresponding category through the category ID of the article and displaying them together.

This mainly depends on the powerful template tags of AnQi CMS, especiallyarchiveList(Article list tag)andcategoryDetail(Category details tag).

Detailed operation steps

Step 1: Ensure the category information is complete

Before you modify the template, please make sure that your category has been configured with a thumbnail and name.

  1. Log in to the Anqi CMS backend.
  2. Enter"Content Management" -> "Document Category.
  3. Edit or create your category. On the category editing page, you will see"Category NameAndThumbnail"and other fields.
    • Make sure that the "category name" has been filled in.
    • In the "thumbnail" area, upload an image that represents the category. Anqi CMS usually supports uploading multiple images, among which"Category thumbnail large image (Logo)"and“Category thumbnail (Thumb)”It is a commonly used image type. You can choose to upload it according to the actual needs of the template. Generally speaking,ThumbIt will be a smaller thumbnail, more suitable for display on the list page.
  4. Save your category settings. Repeat this operation for all categories that need to display thumbnails in the article list.

Step two: Locate the article list template file

The template files of AnQi CMS are usually organized in/template/您的模板目录/The template file path of the article list page will vary according to your content model (such as article model, product model) and category display mode.

  • General article list page:If you are using the default article list page, the file is usually located:{你的模板目录}/archive/list.htmlOr for product models, it may be:{你的模板目录}/product/list.html

Please go through the backend "template design"->"website template managementFind the template you are currently using and locate to the corresponding list page template file for editing.

Step 3: Call the category thumbnail and name in the template.

Locate the template file and then you need to modify the code for the article list loop.

The template syntax of AnQi CMS is similar to the Django template engine, using variables{{变量名}}used for logical control (such as loops, conditional judgments){% 标签 %}.

  1. Loop through the article list. Firstly, there will be aarchiveListtag used to iterate over articles. For example:

    {% archiveList archives with type="page" limit="10" %} {# 假设这是文章列表页,按分页类型显示10篇文章 #}
        {% for item in archives %}
            {# 这里是每篇文章的展示区域 #}
        {% endfor %}
    {% endarchiveList %}
    

    in thisforthe loop,itemThe variable represents each article being iterated over.

  2. Get the category ID of the articleEach article objectitemincludes oneCategoryIdfield, which stores the category ID of the article. You canitem.CategoryIdto get it.

  3. Get the category details by category ID: Next, we will usecategoryDetailtags to pass the article'sCategoryIdto get the details of the category, including its name, thumbnail link, etc.

    {% categoryDetail currentCategory with id=item.CategoryId %}
        {# 在这里,currentCategory变量就包含了当前文章所属分类的所有信息 #}
    {% endcategoryDetail %}
    

    Here we will assign the category details to a variable namedcurrentCategoryYou can name it as needed.

  4. Display the category name and thumbnail:“ Now,currentCategoryThe variable contains the category'sTitle(Name),Thumb(Thumbnail) andLink(Link). You can directly refer to them:

    • Category Name:{{ currentCategory.Title }}
    • Category link: `{{

Related articles

How to convert a timestamp to a specified date format and display it in the AnQiCMS template?

In Anqi CMS template design, we often encounter the need to display timestamp data in a human-readable date format.Whether it is the publication time of the article, the update date of the content, or the record of user activities, this data is usually stored in the database in the form of timestamps.It is particularly important to master how to convert timestamps to the specified date format in templates so that website visitors can clearly and intuitively understand this information.

2025-11-07

How to ensure that custom parameters set in the AnQiCMS backend can be displayed in the front-end template?

The AnQi CMS endows content management with high flexibility, among which the customizable parameter function is the key to meeting the needs of personalized content display.How to accurately display the unique parameters set for content models such as articles, products, or categories on the website front-end template is a concern for many users.This article will detail this process, helping you fully utilize the powerful customization capabilities of Anqi CMS.

2025-11-07

How to implement keyword batch replacement in AnQiCMS and affect the display of front-end content?

It is crucial to maintain the accuracy, timeliness, and brand consistency of content in website operations.Especially when the amount of website content is large, if you need to make global changes to specific keywords or phrases, manual operation will be a huge project that is time-consuming and labor-intensive.AnQiCMS (AnQi CMS) exactly discerned this need, providing a powerful feature named 'Full Website Content Replacement' to help users efficiently manage and update website content, thereby affecting the display effect of front-end content.Why do we need to batch replace keywords? With the development of the enterprise, product updates, or market strategy adjustments

2025-11-07

How to display the list of internal titles (H1, H2, etc.) of the article content on the article detail page?

In Anqi CMS, in order to enhance the reading experience of long articles and the page SEO effect, we usually hope to display a list of internal titles (H1, H2, etc.) on the side or above the article content on the article detail page, which is what we usually call the article catalog or navigation.This makes it convenient for readers to quickly jump to the chapters of interest, and also helps search engines better understand the structure of the article. The AnQi CMS provides a very convenient way to implement this feature, the core lies in its powerful template tags and content field extraction capabilities.###

2025-11-07

How to automatically parse the URL string in the text of AnQiCMS to make it clickable?

In daily content operation, we often need to embed various external or internal links in text content such as articles, product descriptions, and even category summaries.However, manually converting each plain text URL string into a clickable HTML link is not only time-consuming and labor-intensive, but also prone to link errors due to negligence, affecting user experience and search engine optimization.

2025-11-07

How to display the number of views and comments on articles in AnQiCMS templates?

In website operation, the number of page views and comments on articles is an important indicator of the popularity of content and user engagement.AnQiCMS provides flexible template tag functions, allowing you to easily display these key data on the website front end, thereby better attracting visitors and enhancing content value.

2025-11-07

How to customize the display of image carousel (Banner) through template tags in AnQiCMS?

AnQiCMS as an efficient and customizable enterprise-level content management system has a significant advantage in the flexibility of content display.For the common picture carousel (Banner) feature on the website, AnQiCMS provides various ways to customize the display through template tags, allowing you to easily achieve diverse Banner display effects according to different page and business needs.

2025-11-07

How to safely output HTML code in AnQiCMS templates without escaping?

When building and managing website content, we often need to display rich text content with specific formats or interactive effects on the page, such as the main body of articles, product descriptions, and even embedded video players or maps.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that, when handling these requirements, defaults to taking an important security measure: escaping the HTML code output in the template.

2025-11-07