How to call the cover main image, thumbnail, and group image to enrich the display effect?

Calendar 78

In website operation, images are an indispensable element in attracting visitors and conveying information.Reasonably using the cover image, thumbnail, and group image of the article can greatly enhance the visual appeal of the website, enrich the form of content presentation, and make your content more vivid and attractive.AnQiCMS as a flexible and efficient content management system provides a straightforward way to manage and call these image resources, helping you easily achieve a diverse display effect of images.

Understanding the image types in AnQiCMS

In AnQiCMS, we usually come across several different types of images for various purposes:

  1. Cover first image (Logo)This usually refers to the main visual image of an article or page, used to highlight display in top details pages, featured recommendation areas, etc., and is the first impression of the content.
  2. Thumbnail (Thumb)This is a缩小版 preview of an article or page, commonly used in list pages, recommendation modules, related articles, etc., to quickly overview the content in a compact size, thereby improving page loading speed.
  3. Group photo(Images): If your content requires a multi-angle, multi-image display, such as product detail images, event photos, or article illustration galleries, the group photo feature can come in handy.

After understanding these types of images, let's see how to flexibly call them in the template.

Call the cover image of the article (Logo)

The cover image usually carries the role of the 'face' of the content, it should best represent the core theme of the article. In AnQiCMS, you canarchiveDetailEasily get the cover image link of the article.

For example, on the article detail page, if you want to display the cover image of the current article:

<img src="{% archiveDetail with name="Logo" %}" alt="{% archiveDetail with name="Title" %}" />

here,name="Logo"It will directly return the URL of the cover image of the article. Usually, we will combinename="Title"to get the title of the article as the image.altAttribute, this not only helps SEO, but also provides a friendly text prompt when the image fails to load.

The same logic also applies to category pages (categoryDetail) or single pages (pageDetailFor example, to call the Banner large image of a category:

<img src="{% categoryDetail with name="Logo" %}" alt="{% categoryDetail with name="Title" %}" />

To call the thumbnail of an article:Thumb)

The thumbnail is particularly important on the list page or sidebar, as it provides a quick preview in a small size, without occupying too much page space or affecting loading speed.AnQiCMS automatically generates thumbnails based on the backend configuration when you upload article images, and even if you do not actively upload thumbnails, it will extract the first image from the article content as a thumbnail, or use the default thumbnail you have set.

To call the thumbnail of an article, you can use it like this:archiveDetailTags:

<a href="{{item.Link}}">
    <img src="{% archiveDetail with name="Thumb" %}" alt="{{item.Title}}" />
</a>

You can use it on the article list page:archiveListThe tag loops to output multiple articles and calls the thumbnail of each article in the loop.itemThe variable represents the article data of the current loop:

{% archiveList archives with type="list" limit="10" %}
    {% for item in archives %}
    <div class="article-item">
        <a href="{{item.Link}}">
            {# 调用文章缩略图 #}
            {% if item.Thumb %}
            <img src="{{item.Thumb}}" alt="{{item.Title}}">
            {% else %}
            {# 如果没有缩略图,可以显示默认占位图或者不显示 #}
            <img src="/public/static/images/default-thumb.png" alt="{{item.Title}}">
            {% endif %}
        </a>
        <h3><a href="{{item.Link}}">{{item.Title}}</a></h3>
    </div>
    {% endfor %}
{% endarchiveList %}

It is worth mentioning that if you need to process a thumbnail of any image URL (instead of directly calling the already generatedThumbfield), AnQiCMS also provides|thumbFilter. This filter will dynamically generate a thumbnail of the specified image based on the thumbnail size and processing method you configure in the background "Content Settings". For example:

<img src="{{ '/uploads/my_custom_image.jpg'|thumb }}" alt="自定义图片缩略图" />

Invoke the group image of the article (Images)

When a content needs to display multiple related images, the collage feature becomes very useful.This is especially common in product details, case display, image gallery, and other scenarios.AnQiCMS stores group images as an image array, so when calling it in the template, we need to usefora loop to iterate through and display each image.

For example, on the article detail page, if you want to display a set of images:

<div class="article-gallery">
    {% archiveDetail articleImages with name="Images" %}
    {% if articleImages %}
        {% for img in articleImages %}
        <img src="{{ img }}" alt="文章图片" />
        {% endfor %}
    {% else %}
        <p>暂无更多图片展示。</p>
    {% endif %}
</div>

here,archiveDetail archiveImages with name="Images"Assign the URL list of the group image toarticleImagesvariable, then we useforLoop and output images one by one. You can wrap these images into a carousel, gallery, or a simple image list according to your actual needs.

Similarly, categories and single pages also support galleries, such as the category Banner carousel:

<div class="category-banner-slider">
    {% categoryDetail bannerImages with name="Images" %}
    {% if bannerImages %}
        {% for img in bannerImages %}
        <div class="banner-item">
            <img src="{{ img }}" alt="分类Banner" />
        </div>
        {% endfor %}
    {% endif %}
</div>

Practical tips and optimization suggestions

  • Backend "Content Settings"This is the core area for managing image processing. Here, you can set the thumbnail size, cropping or aspect ratio scaling mode, whether to automatically compress large images, and whether to enable WebP format, etc.Properly configure these options can effectively improve website loading speed and user experience.
  • Default thumbnailIt is a good habit to set a default thumbnail in "Content Settings".When an article does not specify a thumbnail, the default image can serve as an elegant placeholder, avoiding ugly blank spaces or damaged image icons on the page.
  • Image optimization: When uploading images, try to use WebP format (AnQiCMS supports automatic conversion), and ensure that the image size matches the display requirements.Images that are too large not only waste storage space but also seriously slow down page loading speed.
  • Semantic HTML: In use<img>Always fill in when labelingaltAttribute, this is not only friendly to SEO, but also improves the accessibility of the website.
  • CSS and JavaScriptThe final display effect of the image, such as layout, size adjustment, responsive layout, and even carousel effects, all need to be further implemented through CSS styles and JavaScript scripts.The tags provided by AnQiCMS are only responsible for obtaining the image resource links, and how to beautifully present them depends on the exquisite design of the front-end code.

With these flexible image call methods and backend fine-tuning, you can easily master the visual content of the AnQiCMS website and provide your visitors with a richer and more attractive browsing experience.


Frequently Asked Questions (FAQ)

1. Why is my article cover image or thumbnail not displaying, or is displaying the wrong image?First, please check whether you have uploaded a "document image" (i.e., thumbnail) or if the article content includes any images.If these two conditions are not met, the system may not be able to generate automatically.Next, go to the "Background Settings" -> "Content Settings", check if the "Default Thumbnail" is set, if it is set, it will automatically display the default image when there is no picture.Finally, ensure that your template code includesname="Logo"orname="Thumb"Spelling is correct.

2. How can I make my group image display as a dynamic carousel effect?AnQiCMS's album tag (Images) Simply responsible for outputting a list of image URLs. To implement the dynamic effect of the carousel, you need to combine JavaScript libraries (such as Swiper, Owl Carousel, etc.) and CSS styles in the front-end template.You can{% for img in articleImages %}The pictures output in a loop are wrapped in the HTML structure required for the carousel component, and then the corresponding JS and CSS files are introduced for initialization.

3. Do the dimensions of the image I uploaded get automatically optimized by AnQiCMS?Yes, AnQiCMS provides powerful image optimization features.In the "Background Settings" -> "Content Settings", you can enable "Whether to automatically compress large images" and set the target width. Enabling "Whether to start Webp image format" will automatically convert uploaded images to smaller WebP format.These settings can effectively reduce the size of image files, improve website loading speed, and do not require you to manually process each image.

Related articles

How to truncate overly long content on the article detail page and add an ellipsis?

In website operation, we often encounter such situations: an article is rich in content, but when it is displayed on the list page, the recommendation area, or some abstract module on the article detail page, we only want to display a part of the content and end it with an ellipsis to maintain the neatness of the page and the fluency of reading.If the entire content is displayed directly, the page will appear lengthy, affecting user experience.Luckyly, AnQiCMS provides us with a very flexible and powerful template mechanism, allowing us to easily truncate long content and elegantly add ellipses to enhance the overall page effect

2025-11-08

How to precisely control which document IDs, titles, and links are displayed on the article detail page?

In website operation, the article detail page is the core touch point for users to obtain information, and its way of information presentation directly affects user experience and the transmission of content value.AnQiCMS as a flexible content management system provides powerful and fine-grained control capabilities, allowing you to accurately display the required document ID, title, link, and other information on the article detail page. To precisely control the content of the article detail page, we mainly rely on the template tag system of AnQiCMS.The core lies in the `archiveDetail` tag

2025-11-08

How to integrate Markdown editor into a website and correctly display mathematical formulas and flowcharts?

In today's increasingly rich digital content, websites are no longer just a pile of text and images.For users who need to display technical documents, academic papers, data analysis reports, and even complex business processes, how to efficiently and beautifully present mathematical formulas and flowcharts has become a key factor in enhancing the professionalism and user experience of the content.AnQi CMS is well-versed in this, providing powerful Markdown editor integration capabilities, with simple frontend configuration, allowing your website to easily support the display of these advanced content.

2025-11-08

How to classify and manage uploaded image resources, and optimize the front-end display?

In the process of using AnQiCMS to manage website content, the management and optimization of image resources is an essential element for improving website user experience and SEO performance.A well-organized image library not only makes daily operations more efficient, but also ensures that website content is presented in **status across different devices and network environments. ### Picture Resource Classification Management: Say goodbye to chaos and have everything in order AnQi CMS provides us with an intuitive picture resource management interface, making a large number of pictures no longer a problem of piles.To start organizing, we just need to go to the back end

2025-11-08

How to format the timestamp of an article into a readable date and time format for display?

In website content operation, the time of article publication or update is an important element in conveying information to visitors.A clear and readable date and time format not only improves user experience but also allows visitors to quickly understand the timeliness of the content.AnQi CMS provides a very practical template tag to help us easily achieve this goal.### Core Tool: `stampToDate` Tag Anqi CMS allows us to use the `stampToDate` tag

2025-11-08

How to display associated categories and tags lists on the article detail page?

When managing website content in AnQi CMS, the article detail page is the core page for users to obtain information.In addition to the content of the article itself, displaying the category information and related tag list of the article to the visitor can greatly improve the user experience, help visitors quickly understand the context of the article, and effectively enhance the internal link structure of the website, which is greatly beneficial for search engine optimization (SEO).Next, we will discuss how to flexibly display these related information on the article detail page of Anqi CMS.AnQi CMS uses an intuitive and powerful template tag system

2025-11-08

How to filter tags through document parameters to achieve a combination display of list content with multiple conditions?

In content operation, we often need to display lists of content with different themes and properties, and allow visitors to filter according to their own needs. For example, a real estate website may need to filter listings by "house type", "location", "area range", and other multi-dimensional combinations.If each time is organized manually or developed custom, it is not only inefficient but also difficult to maintain.AnQiCMS (AnQiCMS) provides a flexible and powerful document parameter filtering mechanism that can help us easily achieve this combination display of list content with multiple conditions. Next

2025-11-08

How to implement pagination for article lists and limit the number of items per page?

In website operation, especially when managing a large amount of content, the pagination display of the article list is an indispensable function.It not only makes it easier for users to browse content, avoids the problem of too much data loading on a single page leading to slow speed, but also improves the overall user experience and SEO friendliness of the website.In AnQi CMS, it is very intuitive to implement pagination for the article list and flexibly control the number of items per page. Next, we will explore how to implement pagination for the article list in the Anqi CMS template and limit the number of articles displayed per page.--- ### Efficient Content Management

2025-11-08