How to add categories for image resources in AnQiCMS and manage the front-end display according to categories?

Calendar 👁️ 76

In AnQiCMS (AnQiCMS), effectively organizing and managing your website image resources is the key to improving operational efficiency and front-end display quality.The image classification function not only makes the background management work organized, but also provides a flexible foundation for the presentation of front-end page content.Below, let's take a detailed look at how to add categories for image resources in AnQiCMS and manage display on the front end巧妙ly.


Background operation: Add image resource categories

AnQiCMS provides an intuitive classification management feature for image resources, which helps you classify images as you manage articles, making it convenient to search and use.

First, you need to log in to the AnQiCMS admin interface.In the left navigation bar, find and click on 'Page Resources', then select 'Image Resource Management.'After entering the image resource management page, you will see a list of all uploaded images.

To create a category for image resources, please click the "Category Management" button at the top of the page.Here, you can add new image categories. Give a clear name to the category, such as 'Product Display Image', 'News Illustration', 'Website Logo', 'Banner Image', etc., so that it is clear during subsequent management.Currently, AnQiCMS supports flat management of image resource categories, allowing you to focus on building practical category hierarchies.

After you create the category, return to the 'Image Resource Management' page.You can select the images you need to categorize in bulk, and then click the 'Batch Transfer Images to Specified Category' feature at the top of the page.Select the category you created earlier to move these images to the corresponding category.This process is very efficient, especially when you need to organize a large number of images, it can save a lot of time.

The main purpose of image classification is for the convenience of backend management.By categorizing, you can quickly filter the required images, such as only viewing "product display images" or "Banner images", which is extremely important basic work for content creation and updates.

Front-end display: How to organize image display by category

In AnQiCMS, images are usually displayed as part of specific content on the front end, such as illustrations for news articles, multi-angle display images for product pages, banners on single pages, and so on.Therefore, the 'Categorized Display Management' of front-end images is more about how to associate these images with your website content (articles, products, single pages, content categories themselves) and display the image collection through content categories.

Although the image resource classification of AnQiCMS is mainly used for background organization, you can combine the "document classification" feature in content management to achieve flexible image display on the front-end. Here are some common front-end display strategies:

1. Call images within content and display them by content category

When you create a "document" (such as an article, product) or a "single page", you will select or upload an image as part of the content, such as a thumbnail, featured image, or collage.These images will be bound to specific content.

  • Call images within the content:

    • You can use it in article or single page detail pages,archiveDetailorpageDetailtags to get the associated images of the current content.
    • For example, to display the cover image and group images of a document, you can write the template code like this:
    {% archiveDetail currentArchive with name="Images" %} {# 获取当前文档的组图 #}
    {% if currentArchive %}
    <div class="image-gallery">
        {% for imageUrl in currentArchive %}
        <img src="{{ imageUrl }}" alt="文档图片" />
        {% endfor %}
    </div>
    {% endif %}
    
    <img src="{% archiveDetail with name='Logo' %}" alt="文档封面首图" /> {# 获取文档封面首图 #}
    
  • Organize the image collection by content category:

    • If you want to display a "picture gallery" or "portfolio" on the front end, you can manage each set of pictures as the content of an "article" or a "product".
    • Then, organize these 'galleries' or 'collections' through 'document classification'.For example, create a "portfolio" content model, with categories such as "photographic works", "illustration design", and others.
    • In the front-end template, you can usecategoryListtags to iterate through these 'portfolio' categories, and then use them under each categoryarchiveListLabel to retrieve and display the corresponding content (i.e., the "works" containing images).

    `twig {# Traverse the portfolio category #} {% categoryList galleryCategories with moduleId=“Your portfolio model ID” parentId=“0” %}

Related articles

How does the `ContentTitles` tag in AnQiCMS help generate and display the table of contents on the article detail page?

In daily content creation and website operation, we often encounter long articles with a large amount of information.This kind of article is rich in content, but without a clear navigation structure, readers are easily lost in the ocean of text and find it difficult to quickly locate the part they are interested in.This not only affects the reading experience, but may also reduce the effective communication of the content.

2025-11-09

How to use the `macro` tag in AnQiCMS to define reusable content display components and improve template efficiency?

In AnQiCMS template development, we often encounter situations where we need to repeatedly write the same or similar code blocks, such as article cards on the website, product display blocks, or buttons with specific styles.This repeated code not only reduces development efficiency, but also makes subsequent maintenance and modification more cumbersome.Luckyly, AnQiCMS provides the `macro` tag, which allows us to define reusable content display components, managing template code like writing small functions, thereby greatly enhancing template efficiency and maintainability.What is

2025-11-09

How does AnQiCMS implement template inheritance through the `extends` tag to simplify the maintenance of page structure display?

In website operation and content management, maintaining a clear, unified, and easy-to-maintain website structure is an important challenge.Especially when there are many pages on a website, repeated page elements (such as headers, footers, navigation bars) would undoubtedly require a lot of time and effort to modify one by one.AnQiCMS (AnQi CMS) is precisely through its powerful template inheritance mechanism, especially the use of the `extends` tag, that helps us efficiently solve this problem.

2025-11-09

How to reuse the code for displaying the common header or footer module in AnQiCMS templates through the `include` tag?

In AnQiCMS template design, efficient code reuse is the key to improving development efficiency and maintenance convenience.Faced with commonly used common elements on the website, such as headers, footers, navigation bars, sidebars, etc., if each page is rewritten repeatedly, it is not only time-consuming and labor-intensive, but also once modified later, it is a problem that affects the whole body.AnQiCMS is well-versed in this, providing users with a powerful template mechanism, where the `include` tag is the tool to achieve this goal.

2025-11-09

How does AnQiCMS automatically filter or process external links in article content and control their display on the front end?

In content operation, properly handling external links in article content is an important link, it not only concerns the health of the website's SEO, but also affects the reading experience of users.AnQiCMS provides a flexible mechanism to help users automatically filter or process external links, and supports control over the front-end display methods. ### Core Function: Automatic Handling Strategy for External Links AnQiCMS provides convenient settings in the background, allowing users to manage external links in article content according to their own operational strategies.

2025-11-09

How to use the `truncatechars` or `truncatewords_html` filter to truncate text or HTML content and add an ellipsis for display?

When operating a website, we often encounter situations where we need to display long content, but the page space is limited.For example, on the article list page, we usually only want to display the abstract of the article; on the product detail card, we may only want to show a brief description.If this content is not processed, it may overflow the container, destroy the page layout, and affect the user experience.The AnQi CMS knows the importance of content display and provides us with powerful template functions.

2025-11-09

How does AnQiCMS's `urlize` filter automatically convert URLs and email addresses in plain text to clickable links?

In website content operation, we often need to include some URLs or email addresses in the articles or descriptions.In traditional methods, this information is often just plain text, and users need to manually copy and paste to access it, which undoubtedly increases the user's operation cost and affects the interactivity of the content. 幸运的是,AnQiCMS cleverly goes through its powerful template filter mechanism, providing us with an elegant solution - that is the `urlize` filter.

2025-11-09

How to flexibly control the conditional display and loop output of content in AnQiCMS templates through `if`, `for`, and other logical tags?

In AnQiCMS, templates are the core of building the appearance and displaying content of a website.It is crucial to be proficient in using the logical tags in the template to make the content of the website more flexible and intelligent.This is the two great tools of dynamic content display, `if` conditional judgment and `for` loop output tags.They allow you to display or hide content based on specific conditions, efficiently traverse and output a series of data, thereby creating highly customized and responsive frontend pages to meet user needs.

2025-11-09