How to customize the display of thumbnail and cover images for articles or products?

Calendar 👁️ 83

In website content operation, the visual appeal of images is crucial.Whether it is to show the essence of an article or highlight the highlights of a product, a suitable thumbnail and cover image can greatly enhance the user experience and have a positive impact on the spread of content.AnQiCMS (AnQiCMS) provides rich and flexible features, allowing us to easily customize the display of images for articles or products according to specific needs.

This article will introduce in detail how to manage and display thumbnails and cover images in Anqi CMS from two aspects: background configuration and template call.


One, backend configuration: global settings and content management

It is very important to understand how the Anqi CMS backend handles and manages images before using them. These settings will directly affect the display effect of images on the front end.

1. Global content settings: Unified image processing strategy

In the Anqi CMS backend management interface, go to the "Backend Settings" under the "Content Settings" section, and you will find a series of options related to image processing.These settings are designed to help us automate the optimization of images, ensuring the loading speed and display quality of website images.

  • Thumbnail Processing MethodHere are various scaling modes, such as 'scale proportionally based on the longest side' which ensures the integrity of the image and adjusts the size, and 'crop to the shortest side' which will center-crop to fill the preset width and height.Choose the most suitable method based on the overall design style of the website and the display requirements of the images, to avoid image distortion or unnecessary blank spaces.
  • Thumbnail sizeThis is a very practical setting item. You can set a recommended width and height based on the actual display size of the thumbnail in the website front-end layout.The Anqi CMS will automatically generate a thumbnail version of the uploaded image according to the thumbnail processing method you choose.Reasonable settings can effectively reduce the file size of images and speed up page loading.
  • Default thumbnail: When an article or product does not have a thumbnail image uploaded separately, the system can automatically reference the default image set here.This is very helpful to maintain the visual style consistency of the website, ensuring that there is a visual element even if the content of the specified image is not provided.
  • Whether to automatically compress large images and specified widthIf your website frequently uploads high-resolution images, enabling this feature can automatically compress oversized images to a specified width, thereby saving storage space and improving website performance.This setting is particularly friendly to mobile users and can reduce data consumption.
  • Whether to enable Webp image formatWebp is a more efficient image format that can provide the same or even better image quality with smaller file sizes.Enable this feature and new uploaded JPG, PNG images will be automatically converted to Webp format, further optimizing the website loading speed.
  • batch regenerate thumbnailsIf you modify the thumbnail size settings, you can use this feature to batch process all website images to ensure that all old images can be generated with the corresponding thumbnail versions according to the new rules.

2. Image management on the content editing page: flexible upload and automatic extraction

When creating or editing articles, products, categories, or single pages, AnQi CMS provides an intuitive interface for managing related images.

  • Article/Product Thumbnail: When posting articles or products, you can directly upload images as their thumbnails.It is worth mentioning that even if you do not upload manually, if the content of the article contains images, Anqi CMS can intelligently automatically extract the first image in the content as a thumbnail, saving a lot of trouble of manual operation.
  • Category/Banner image and thumbnail of single page: For category pages or standalone pages (such as "About Us"), you can upload a "Banner image" specifically for the banner display at the top of the page, as well as a "thumbnail" for the small image display in the category list or navigation.These images usually have specific design requirements and can be uploaded according to the page layout.
  • Image resource libraryAll uploaded images will be collected under 'Page Resources' under 'Image Resource Management.'You can perform image classification management, batch deletion, replacement, and even view the original large images, file information, etc., to achieve centralized management of image assets.

II. Template invocation: Flexible display of image data

The backend configuration determines how images are processed and stored, while the frontend template determines how these images are displayed to users.The AnQi CMS template engine is similar to Django, allowing us to flexibly call various image data through specific tags and variables.

1. Basic image field parsing

Whether it is an article, product, category, or single page, Anqi CMS provides several core image fields for template calls:

  • LogoCover image or main image of category/page, such as the main image in article list.
  • ThumbA thumbnail image of the content, usually a small size image processed by the system, suitable for list pages and other scenarios.
  • ImagesIf the content supports multi-image display (such as product group images, categories, or single-page Banner carousel), this field will return an array of image URLs that need to be displayed in a loop.

2. Call article/product images

On the article detail page or list page, we can usearchiveDetailorarchiveListtags to get images.

  • Get the cover image and thumbnail of the article detail page:
    
    {% archiveDetail with name="Title" %}
    <img src="{% archiveDetail with name="Logo" %}" alt="{% archiveDetail with name="Title" %}" />
    <img src="{% archiveDetail with name="Thumb" %}" alt="{% archiveDetail with name="Title" %}" />
    
  • Get the cover image and thumbnail of the article list:
    
    {% archiveList archives with type="list" limit="10" %}
        {% for item in archives %}
        <a href="{{item.Link}}">
            <h5>{{item.Title}}</h5>
            {% if item.Logo %} {# 判断Logo是否存在 #}
                <img src="{{item.Logo}}" alt="{{item.Title}}" />
            {% endif %}
            {% if item.Thumb %} {# 判断Thumb是否存在 #}
                <img src="{{item.Thumb}}" alt="{{item.Title}}" />
            {% endif %}
        </a>
        {% endfor %}
    {% endarchiveList %}
    
  • Get the group image (Images) of the article/product:ImagesIt is usually a list of image URLs, which needs to beforlooped through.
    
    {% archiveDetail archiveImages with name="Images" %}
    <div class="product-gallery">
        {% for imgUrl in archiveImages %}
            <img src="{{imgUrl}}" alt="产品图片" />
        {% endfor %}
    </div>
    

3. Call Category Image

Use in Category Details Page or NavigationcategoryDetailorcategoryListTag to Get Image

  • Get Banner Image and Thumbnail of Category Details Page:
    
    <h1 class="category-title">{% categoryDetail with name="Title" %}</h1>
    {% categoryDetail categoryBanner with name="Images" %} {# Images字段可作为Banner组图 #}
    {% if categoryBanner %}
        <div class="category-banner">
            {% for img in categoryBanner %}
                <img src="{{img}}" alt="{% categoryDetail with name="Title" %}" />
            {% endfor %}
        </div>
    {% endif %}
    <img src="{% categoryDetail with name="Logo" %}" alt="{% categoryDetail with name="Title" %}" />
    <img src="{% categoryDetail with name="Thumb" %}" alt="{% categoryDetail with name="Title" %}" />
    
  • Get Thumbnails of Category List:
    
    {% categoryList categories with moduleId="1" parentId="0" %}
        {% for item in categories %}
        <a href="{{ item.Link }}">
            <span>{{item.Title}}</span>
            {% if item.Thumb %}
                <img src="{{item.Thumb}}" alt="{{item.Title}}" />
            {% endif %}
        </a>
        {% endfor %}
    {% endcategoryList %}
    

4. Call the single page image

The way to call the image of the single page is similar to classification, usingpageDetailorpageList.

  • Get the Banner image and thumbnail of the single page details:“`twig

    {% pageDetail with name=“Title” %}

    {% pageDetail pageBanner with name=“Images” %} {% if pageBanner %}
    {% for img in pageBanner %}{% pageDetail with name={% endfor %}
    {% endif %}{% pageDetail with name=<img src=“{%

Related articles

How to display the list of recommended content related to the current document in AnQi CMS?

When operating a website, we often hope that users can smoothly find more interesting content after reading a wonderful article.This not only extends the user's stay time and reduces the bounce rate, but is also an effective way to enhance the overall value of the website's content and SEO performance.AnQi CMS knows this, and therefore it provides a variety of flexible ways to display the recommended content list related to the current document, helping us better guide users. To implement recommendations for related content, we first need to understand how Anqicms defines 'related'.In system design, "related" can be reflected at several levels

2025-11-07

How to get and display the previous/next content of the current document?

In content-based websites, providing visitors with a convenient navigation experience is crucial, among which the 'Previous' and 'Next' functions are standard features of the article detail page.They can not only guide users to continue browsing more content, effectively increase the website's PV (Page View), but also help search engines better understand the structure of the website's content to optimize SEO performance.AnQiCMS fully considered this requirement, providing us with very simple and intuitive template tags to easily implement this feature.### Learn about AnQiCMS template mechanism At

2025-11-07

How to display the detailed content of articles or products and support lazy loading of images?

A Guide to Displaying Content Details and Lazy Loading Images in AnQi CMS in Today's Digital World, the way websites present content directly affects user experience and search engine rankings.Whether it is a detailed article introduction or a beautiful product display, how to present the content efficiently and aesthetically to the visitors and ensure the website loading speed is a challenge that every operator needs to face.AnQiCMS (AnQiCMS) is a powerful content management system that provides us with flexible tools to meet these challenges.This article will delve into how to fully utilize the functions of Anqi CMS

2025-11-07

How to display document recommendation attributes (such as headline, recommendation) on the document list or detail page?

It is crucial to highlight the key content on the website in a content management system to attract users and increase page views.AnQiCMS (AnQiCMS) provides powerful document recommendation attribute functions, allowing website operators to flexibly mark and display articles.This article will introduce how to cleverly use these recommended attributes in the document list and detail page of Anqi CMS to make your website content more vivid and guiding.### Learn about the recommended features of AnQi CMS AnQi CMS has designed various recommended features for each document

2025-11-07

How to display the page views and comment count of the document?

In website content operation, accurately displaying the document's page views and user comment numbers is a key indicator of the popularity and user activity of the content.AnQiCMS provides flexible and intuitive template tags, helping us easily display these important data in the various corners of the website without delving into complex backend logic.### Show view count and comment number on document detail page When you want to display the current view count and total number of comments on a single document detail page (such as an article, a product detail page), AnQiCMS's

2025-11-07

How to specify and display different templates for specific documents or categories?

AnQi CMS provides a flexible and powerful template management mechanism that allows users to specify and display unique templates for documents, categories, and even single pages based on different content types or specific needs.This feature greatly enhances the personalized display capabilities and operational efficiency of the website content.Understanding the significance of template customization In website operations, the diversity of content often requires different presentation methods.An in-depth technical article may require a concise and clear layout so that readers can focus on the content itself;A promotional activity page may require prominent visual elements and call-to-action buttons

2025-11-07

How to display extra field data under a custom content model in Anqi CMS?

In AnQi CMS, the flexibility of the content model is one of the highlights of the project, allowing us to create and manage various content structures according to the actual business needs.Whether it is an article, product, event, or any other information that requires a specific field to describe, it can be easily realized through a custom content model.After adding exclusive additional fields to these models, the next step naturally is how to accurately and beautifully display this valuable data on the website front-end.This is not a complex task, Anqi CMS provides intuitive and convenient template tags to complete it

2025-11-07

How to display single page content on the front end of a website (such as About Us, Contact Us)?

In website operation, single-page content like "About Us" and "Contact Us" is indispensable, as it carries important functions such as displaying corporate image, providing contact information, or stating service terms.For friends using AnQiCMS, it is actually a very direct and flexible thing to beautifully display these single-page contents on the website front end. ### Single Page Content Management Overview Firstly, we need to create and manage these single pages in the AnQiCMS backend system.In the left navigation bar of the background, you can find the "Page Resources" menu

2025-11-07