How to exclude certain specific categories of articles from the AnQiCMS document list?

Calendar 👁️ 61

During the operation of the website, we often need to manage and display content in a refined manner.For example, we may want to hide certain internal announcements, specific promotional content, or some draft category articles that are not suitable for external display when recommending articles on the homepage.AnQiCMS (AnQiCMS) is a powerful content management system that fully considers such needs and provides a simple and flexible way to achieve this - by specifying exclusion parameters in the document list tag.

This article will delve into how to exclude certain specific category articles from the document list in AnQiCMS, helping you more effectively control content display and optimize the user experience.


Precision control: Exclude specific category articles from the AnQiCMS document list

One of the core advantages of Anqi CMS lies in its flexible content management and template tag system. When you need to display a list of articles on the front page of the website, you will usually usearchiveListThis powerful template tag. It can not only help you filter articles of specific categories, sort by various conditions, but also easily exclude articles from category classification.

Core tool:excludeCategoryIdParameter

To implement the classification exclusion of document lists, AnQiCMS provides a very intuitive and powerful parameter:excludeCategoryId. By definition, this parameter allows you to specify one or more unique category IDs, so that articles under these categories will not appear in the current document list.

How to find the category ID?

In the Anqi CMS backend, you can easily find the unique ID of each category.

  1. Log in to your AnQiCMS background.
  2. Navigate to 'Content Management' -> 'Document Categories'.
  3. In the category list, each category entry will display an "ID" column.This is the category ID you need to use. Moreover, when editing a category, the URL in the browser address bar will also contain the category ID (for example:.../category/edit?id=10Here, 10 is the category ID).

How to use in the templateexcludeCategoryId?

Once you have determined the category ID to exclude, you can apply it to your template file."),archiveListin the tags.

Basic usage: Exclude a single category.

Assuming you want to exclude articles with ID10from the 'Internal Announcement' category. YourarchiveListtag can be written as:

{% archiveList archives with type="page" limit="10" excludeCategoryId="10" %}
    {# 在这里循环显示您的文章内容 #}
    {% for item in archives %}
        <li>
            <a href="{{item.Link}}">
                <h5>{{item.Title}}</h5>
                <p>{{item.Description}}</p>
                <span>发布日期:{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
            </a>
        </li>
    {% empty %}
        <li>当前没有可显示的文章。</li>
    {% endfor %}
{% endarchiveList %}

Advanced usage: Exclude multiple categories

If you need to exclude multiple categories at the same time, for example, ID is10of 'Internal Announcement' and ID is12of 'Draft' category, you just need to separate these category IDs with commas:

{% archiveList archives with type="page" limit="10" excludeCategoryId="10,12" %}
    {# 在这里循环显示您的文章内容 #}
    {% for item in archives %}
        <li>
            <a href="{{item.Link}}">
                <h5>{{item.Title}}</h5>
                <p>{{item.Description}}</p>
                <span>发布日期:{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
            </a>
        </li>
    {% empty %}
        <li>当前没有可显示的文章。</li>
    {% endfor %}
{% endarchiveList %}

excludeCategoryIdwithcategoryIdto be used together

excludeCategoryIdParameters can be used withcategoryIdUsing parameters in conjunction, achieve more refined filtering. For example, you might want to filter only in the "News Center" (assuming ID is1Below display articles, but exclude "Industry Activities" within "News Center" (assuming ID of5) articles of this subcategory.

In this case,categoryIdFirst, filter out all articles under the 'News Center' and its subcategories (ifchildthe parameter is true, the default is true), thenexcludeCategoryIdexclude articles with category ID5's article.

{% archiveList newsArticles with type="page" categoryId="1" excludeCategoryId="5" limit="10" %}
    {# 显示属于分类ID 1,但不属于分类ID 5 的文章 #}
    {% for item in newsArticles %}
        <li>...</li>
    {% empty %}
        <li>没有找到符合条件的新闻文章。</li>
    {% endfor %}
{% endarchiveList %}

Practical suggestions and precautions

  • Please specify the category ID:Before modifying the template, please ensure that the category ID you want to exclude is accurate. An incorrect ID may lead to unexpected results.
  • Content existence:Please note,excludeCategoryIdJust control content:Front-end displayThis content is not deleted. The excluded articles still exist in your AnQiCMS system and can be accessed directly via their URL.
  • Used in multiple places:If your website displays article lists in multiple places (such as the homepage, sidebar, specific topic pages, etc.) and you want to apply the same exclusion logic in all these places, you need to set it in each relevantarchiveListAdd tags toexcludeCategoryIdParameter.
  • SEO consideration:If the excluded category articles are ones you don't want to be crawled by search engines, simply byexcludeCategoryIdIt is not enough to hide on the front end. You may need to combine the AnQiCMS Robots.txt configuration or the article detail page settings to prevent search engines from indexing.noindexSet to block search engine indexing.

by masteringexcludeCategoryIdParameter, you can manage the content presentation on AnQiCMS website more flexibly and accurately, ensuring that visitors always see the article list that best suits your operational strategy.


Frequently Asked Questions (FAQ)

Q1:excludeCategoryIdWhether the parameter will affect the SEO performance of the article?

A1:excludeCategoryIdMainly controls the article in a specific list.Front-end display. The article itself is still accessible if there is a URL link available and it has not been blocked by Robots.txt ornoindexTags and SEO means to prevent, search engines can still crawl and index these articles. If you do not want certain category articles to be indexed by search engines, it is recommended to add advanced SEO settings through the background "Document Category" editing page or the individual article editing pagenoindexTags, or configure them in the AnQiCMS Robots.txt management.

Q2: If I exclude a parent category, will all subcategory articles also be automatically excluded?

A2:excludeCategoryIdThe parameter directly affects the category ID associated with the article. If you exclude the ID of a parent category (for example, ID 10), then the articles directly belonging to ID 10 will be excluded.If the article of the subcategory itselfCategoryIdIs a subcategory ID (for example, if ID 11 is a subcategory of ID 10), unless you also specifyexcludeCategoryIdID 11 explicitly in it, otherwise these subcategory articlesWill not be automatically excludedTo ensure the entire category tree is excluded, you may need to manually list all the parent and child category IDs related to it.

Q3: BesidesexcludeCategoryIdWhat are some parameters that can help me refine the article list?

A3: AnQiCMS'archiveListTags provide various powerful filtering parameters:

  • categoryId: Specify the category ID(s) to include (multiple IDs can be separated by commas).
  • moduleId: Based on the article

Related articles

How to sort the document list by publication time or views?

In the world of website operation, the organization and presentation of content directly affects the user experience and the efficiency of information transmission.AnQiCMS (AnQiCMS) as an efficient content management system, fully understands the importance of this requirement, and therefore provides powerful and flexible options for sorting document lists, allowing you to easily control the display priority of content according to different operation goals.Today, let's delve into how to sort document lists in Anqi CMS using publication time or views.

2025-11-06

How to filter and display the document list based on recommended properties (Flag)?

As an experienced website operations expert, I know that the powerful function of the Content Management System (CMS) lies in its flexibility and ease of use.In AnQiCMS (AnQiCMS), the 'recommended attribute' (Flag) of the document is such a seemingly simple feature, which can actually greatly improve the efficiency of content operation and the diversity of website display.Today, let's delve into how to cleverly use recommendation attributes to achieve precise filtering and display of document lists.

2025-11-06

How to implement pagination and page number display for article lists in AnQi CMS?

As an experienced website operations expert, I am well aware of the crucial role of a powerful and easy-to-use content management system for the success of a website.AnQiCMS (AnQiCMS) boasts a high-performance architecture based on the Go language and flexible template mechanism, providing an excellent experience in content publishing and management.Among them, efficiently displaying a large amount of content, especially implementing the pagination function of the article list, is an indispensable factor in improving user experience and website SEO performance.Today, let's delve deeply into how AnQi CMS cleverly implements this feature and demonstrates friendly page navigation.--- ##

2025-11-06

How to get the list of articles under a specified category in AnQiCMS?

## Easily retrieve the list of articles under a specified category in AnQiCMS As an experienced website operations expert, I fully understand the core value of a content management system (CMS) lies in its ability to organize and present content.Among many features, how to efficiently extract and display articles from a specific category is an indispensable part of the daily work of website operators.Today, let's delve deep into how AnQiCMS can help you achieve this goal, making technical details intuitive and easy to understand.

2025-11-06

How to implement the 'related articles' recommendation feature in AnQiCMS?

As an experienced website operations expert, I am well aware of the importance of the 'related articles' recommendation feature for improving user experience, extending user stay time, reducing bounce rate, and optimizing the internal link structure of the website (SEO).AnQiCMS (AnQiCMS) provides a flexible and efficient solution in this regard, allowing website operators to easily implement intelligent content recommendations.

2025-11-06

How to perform keyword search on the AnQiCMS document list page?

Good, as an experienced website operations expert, I am happy to write a practical guide for you on how to perform keyword search in the AnQiCMS document list page. --- ## Efficient Keyword Search on AnQiCMS Document List Page: A Practical Guide Quickly locating and managing a large number of documents is crucial for improving efficiency in daily content operations.With the continuous enrichment of website content, we often need to accurately retrieve specific articles or products from the vast sea of information.

2025-11-06

How to implement custom parameter filtering for document lists in AnQiCMS (such as by region, type)?

## Unlock content potential: How AnQiCMS implements custom parameter filtering of document lists (such as by region, type) As an experienced website operations expert, I am well aware of the importance of an efficient content management system (CMS) in enhancing user experience and content value.AnQiCMS with its flexible and customizable features provides many conveniences in the content operation field.

2025-11-06

How to display the number of documents under each category on the category list page?

As an experienced website operations expert, I am well aware that how to efficiently display data in content management is crucial for user experience and the overall performance of the website.AnQiCMS (AnQiCMS) with its flexible and powerful template engine, allows us to easily implement these seemingly complex requirements.Today, let's talk about how to clearly display the number of documents under each category on the category list page, which not only makes it easy for visitors to understand but also can improve the website's SEO performance to some extent.

2025-11-06