How to implement article list filtering by category, tag, or recommended attributes?

Calendar 👁️ 73

In website operation, how to efficiently organize and display a large amount of content, and ensure that users can quickly find the information they need, is the key to improving user experience and content value.AnQiCMS provides powerful content management functions, among which the flexible filtering mechanism of the article list can help us easily achieve accurate content presentation.This article will discuss in detail how to filter and display article lists in Anqi CMS through categories, tags, and recommended attributes.


How to accurately display the AnQi CMS article list according to categories, tags, or recommended attributes?

The core value of the content management system lies in the organization and presentation of content.When we accumulate a large amount of articles, products, or other content, if we cannot classify and filter them effectively, it will be difficult for users to quickly find the information they are interested in.The Anqi CMS provides intuitive and powerful template tags, allowing us to flexibly display content lists based on various dimensions such as categories, tags, and recommended attributes.

Core tool:archiveListDocument List Tags

In the template system of Anqi CMS,archiveListTags are the foundation for displaying article lists. They provide rich parameters, allowing us to query and output content based on various conditions.Whether it is a simple list display or a complex scene requiring pagination,archiveListCan all胜任.

In the template file,archiveListTags are usually withforLoop and combine them to iterate through each article found. For example:

{% archiveList archives with moduleId="1" type="page" limit="10" %}
    {% for item in archives %}
        <li><a href="{{item.Link}}">{{item.Title}}</a></li>
    {% empty %}
        <li>暂无内容</li>
    {% endfor %}
{% endarchiveList %}

The above code demonstrates a basic article list,moduleId="1"usually represents the article model (the specific ID needs to be confirmed according to the backend settings),type="page"indicating that the list supports pagination,limit="10"Then it limits the display of 10 articles per page.

Next, we will specifically explain how to apply the core filtering requirements.archiveListTags and their auxiliary tags.

Method one: Filter content by category.

Classification is one of the most basic ways to organize content. In Anqi CMS, we can specify the category of the article, and display the content according to these categories on the front page.

To filter articles by category,archiveListTags providedcategoryIdparameters. You can directly specify one or more category IDs to get the articles under them.

For example, if we want to display all articles under the category with ID 1, we can write it like this:

{% archiveList archives with moduleId="1" categoryId="1" type="page" limit="10" %}
    {% for item in archives %}
        <li><a href="{{item.Link}}">{{item.Title}}</a></li>
    {% endfor %}
{% endarchiveList %}

If you need to display articles for multiple categories (for example, categories with IDs 1, 2, 3), you can separate the category IDs with commas:categoryId="1,2,3". Additionally,childThe parameter (default is true) controls whether to include articles of subcategories. If you only want to display the current category without including its subcategories, you can setchild=false.

In order to make it convenient for users to select categories on the front end, we still need to combinecategoryListtags to display all clickable category navigation:

{% categoryList categories with moduleId="1" parentId="0" %}
    {% for item in categories %}
        <a href="{{item.Link}}">{{item.Title}}</a>
    {% endfor %}
{% endcategoryList %}

After the user clicks the category link, the pseudo-static rule of Anqi CMS will automatically parse the category ID or alias and pass it to the page template,archiveListThe tag can automatically identify the category ID of the current page, no manual setting is requiredcategoryId.

Method two: Filter content by tag

Tags provide a more flexible way to associate content, it does not adhere to a fixed hierarchical structure, and can link articles of different categories and models through a common topic.

AnQi CMS providestagDataListTags are used to retrieve the list of articles under a specified tag.

For example, to display all articles under the tag with ID 5:

{% tagDataList archives with tagId="5" type="page" limit="10" %}
    {% for item in archives %}
        <li><a href="{{item.Link}}">{{item.Title}}</a></li>
    {% endfor %}
{% endtagDataList %}

To get all tags or related tags of the current article, you can usetagListtags. This is very useful for building a hot tag cloud or displaying related tags on the article detail page:

{% tagList tags with limit="10" %}
    {% for item in tags %}
        <a href="{{item.Link}}">{{item.Title}}</a>
    {% endfor %}
{% endtagList %}

Similar to categories, when the user clicks the tag link,tagDataListthe tags can automatically identify the tag ID of the current page.

Method three: filter content according to recommended attributes

The recommendation attribute is a special filtering mechanism that allows operators to mark articles with "recommended", "headlines", "slides", and other tags for prominent display in specific areas of the website.The Anqi CMS backend provides various recommendation attributes (such as: Headline[h], Recommendation[c], Slider[f], etc.).

To filter articles by recommended attributes, just inarchiveListUsed in tagsflagParameter.

For example, to display all articles marked as "recommended":

{% archiveList archives with moduleId="1" flag="c" type="page" limit="10" %}
    {% for item in archives %}
        <li><a href="{{item.Link}}">{{item.Title}}</a></li>
    {% endfor %}
{% endarchiveList %}

You can choose different attribute letters according to your actual needs, such asflag="h"representing the headline,flag="f"Represents a slide. At the same time,

Related articles

How to customize the article display form in AnQi CMS based on the content model?

In Anqi CMS, using the content model to flexibly define the display form of articles is one of its core advantages.It can make your website content not limited to traditional 'article' or 'product' formats, but can present diverse content structures according to actual business needs.In the digital world, the content carried by websites is much richer than we imagine.

2025-11-08

How does the AnQiCMS Sitemap tool improve the visibility of a website on search engine results pages?

In today's highly competitive online environment, ensuring that your website content is discovered and displayed at the top of search engine results pages (SERP) is fundamental for enhancing brand visibility and attracting potential users.AnQiCMS (AnQiCMS) is well aware of this as a content management system designed specifically for small and medium-sized enterprises and content operation teams.It comes with a powerful Sitemap tool designed to help users efficiently optimize their websites, thereby significantly improving their visibility in search engines.What is a Sitemap?

2025-11-08

How to ensure that the data collected through content acquisition and batch import can be displayed quickly on the front page?

In website operation, efficient content management is the key to improving user experience and SEO effectiveness.AnQiCMS (AnQiCMS) relies on its powerful content collection and batch import functions, greatly reducing the burden of content construction.However, we often encounter a core issue: How can we ensure that the content imported or collected through automated means is displayed on the front page to the user quickly and without delay?The Anqi CMS was designed with efficiency in content management and timely front-end display in mind, its underlying mechanisms and operational strategies can effectively help us solve this problem

2025-11-08

How to optimize the display form of website URLs in search engines with the help of pseudo-static and 301 redirection functions?

In website operations, a clear, readable, and SEO-friendly URL structure is a key element in improving website visibility and user experience.AnQiCMS (AnQiCMS) knows this point, therefore it builds in these two important functions of pseudo static and 301 redirection, aiming to help users easily optimize the display form of the website in search engines, thereby bringing better ranking and traffic performance.

2025-11-08

What sorting methods does AnQi CMS support to display articles and product lists?

How to flexibly display articles and product lists in a content management system is the key to improving user experience and optimizing information architecture.AnQiCMS (AnQiCMS) has provided us with a variety of practical sorting methods in this regard, allowing us to accurately present information based on different business needs and content strategies.### Core Sorting Mechanism: Flexible Control of Content Order AnQi CMS grants us fine-grained control over the display order of articles and product lists through its powerful template tag system

2025-11-08

How to configure a custom display template for the document detail page?

Manage website content in AnQi CMS, flexibility is one of its core advantages.When you need to present a unique content layout or style for a specific document detail page, the system provides powerful custom template functionality.This means that you can configure a dedicated display template for the document based on its type, content, and even specific document requirements, thus breaking away from the one-size-fits-all approach of traditional CMS and creating pages with greater appeal and functionality.The reason why AnQi CMS can achieve this is due to its 'flexible content model' design and the continuous enhancement of template customization capabilities in system iterations

2025-11-08

How to set up document thumbnails and control their display on list pages?

In a content management system, a striking thumbnail can greatly enhance the attractiveness of the content, whether it is in an article list, product display, or other content aggregation pages, it is an important visual element to guide users to click.AnQiCMS (AnQiCMS) is well aware of this and provides flexible thumbnail settings and display control features to help optimize the visual effects and user experience of your website.Next, we will discuss in detail how to set the thumbnail of the document in Anqi CMS and master its various display methods on the list page.### The First Part

2025-11-08

How to use the pseudo-static function of AnQi CMS to optimize URL display and improve SEO effect?

In website operation, the URL (Uniform Resource Locator) plays a vital role.A clear, meaningful, and easy-to-understand URL not only improves user experience but is also an indispensable part of search engine optimization (SEO).The traditional dynamic URL often contains parameters and numbers that are difficult to understand, while the pseudo-static URL, through rewriting technology, makes it look as simple and standardized as a static HTML page, thus gaining the favor of search engines and users.AnQiCMS (AnQiCMS) knows the impact of URL structure on website SEO

2025-11-08