How to exclude content of a specific category from the article list?

Calendar 👁️ 72

In website content operation, we often encounter such needs: we hope to display most of the content on the article list page, but some specific category articles are not listed.For example, you may have a "Company Announcement" category that you only want to display on a separate page, or some articles for internal reference that you do not want to appear in the regular public article list.AnQiCMS (AnQiCMS) provides a very flexible and intuitive way to handle this situation, allowing you to precisely control the display of content on the front end.

AnQi CMS uses its powerful template tag system to make content display highly customizable. When we need to display a list of articles on the website, we usually usearchiveListThis is the core tag. This tag can help us call various article content, and it also provides rich parameters for filtering and sorting, including a special parameter for excluding specific categories.

To achieve the purpose of excluding specific category content from the article list, we mainly usearchiveListin the labelexcludeCategoryIdThe parameter serves a very direct function: it tells the system to skip all articles under the specified category when generating the article list.

It is also very simple to operate. First, you need to log in to the Anqi CMS backend management interface, find and enter the "Content Management" under the "Document Classification" page.Here you can see all the categories created and their corresponding IDs.This ID is the unique identifier for each category and is the key to our exclusion operation.For example, assume that the ID of your "Company Announcement" category is5While the ID of the 'Internal Materials' category is12.

Next, go back to the front-end template of your website used to display the article list. Find the code that usesarchiveListThe section of the tag. Usually, this is on the list page, homepage, or other page templates where articles need to be aggregated. In this tag, you can add it like thisexcludeCategoryIdparameters:

{% archiveList archives with type="page" limit="10" excludeCategoryId="5,12" %}
    {# 列表内容的循环展示代码 #}
    {% for item in archives %}
    <li>
        <a href="{{item.Link}}">
            <h5>{{item.Title}}</h5>
            <div>{{item.Description}}</div>
        </a>
    </li>
    {% endfor %}
{% endarchiveList %}

In the example code above,excludeCategoryId="5,12"Tell Anqi CMS, when generatingarchivesthis article list, please automatically exclude category ID of5and12All articles. If you need to exclude only one category, you can enter a single ID, for exampleexcludeCategoryId="5"If you need to exclude multiple categories, you can use English commas to connect these category IDs, as shown in the example.

The advantage of this method lies in its flexibility and ease of use. You do not need to modify complex logic code, just add or modify a parameter in the template tag, and you can easily achieve fine-grained control over the content of the article list.It is crucial to maintain the clarity of the website content structure, ensuring that users see the most relevant and appropriate content in different regions.For example, by excluding promotional activity categories, your regular news list can focus more on industry trends;By excluding expired activity categories, your activity list will always display the latest content, enhancing user experience.

In practice, it is recommended that you thoroughly test the template after modification to ensure that the content displayed meets expectations.At the same time, clearly recording the purpose and ID of each category will help with future content management and template maintenance.


Frequently Asked Questions (FAQ)

1.excludeCategoryIdandcategoryIdWhat is the difference between parameters?

excludeCategoryIdThe parameter is used to 'exclude' specific categories of content from the article list, that is, to display all articles of all categories, except those explicitly specified to be excluded, and thatcategoryIdThe parameter is the opposite, it is used to 'include' specified category content, that is, only to display articles under the specific category or categories you explicitly specify, and not to display articles under other categories.Both are complementary filtering methods, choose to use according to your specific needs.

2. Where can I find the category ID that needs to be excluded?

You can find the category ID in the Anqi CMS backend management interface.After logging into the backend, navigate to the "Content Management" -> "Document Category" page.On this page, you will see a list of categories, with each category name usually displayed next to its corresponding unique numeric ID.Note down these IDs to use them in template tags.

3. UseexcludeCategoryIdWill excluding content affect the website's SEO?

In most cases, to useexcludeCategoryIdThe parameter excludes some content in the front-end template, mainly affecting the visual experience of users on specific pages.If excluded content can still be crawled by search engines through other pages (such as individual category pages, site maps), then it will not have a negative impact on the SEO performance of such content.This parameter only controls the display logic of content in a specific list, rather than deleting or hiding it from the website so that it is not discovered by search engines.

Related articles

How to set the number of articles or products displayed per page in AnQiCMS?

In website operation, especially when managing pages that require a large amount of content display, such as article lists and product display pages, how to efficiently control the number of items displayed per page directly affects user experience and page loading speed.AnQiCMS provides a flexible and powerful mechanism to meet this requirement, it allows you to customize the display of each page according to different page and content types through fine-grained control at the template tag level.The Anqi CMS can provide this flexibility because it closely integrates the display logic of the list content with the template design

2025-11-08

How to display the list of articles by category in AnQiCMS?

It is crucial to organize and display information efficiently in website content management.For users, being able to clearly browse article lists by different categories greatly enhances the access experience and also helps search engines better understand the website structure, thereby optimizing SEO effects.AnQiCMS (AnQiCMS) provides us with flexible and powerful tools, making this requirement easily accessible.

2025-11-08

How does AnQiCMS adapt the display of website content for PC and mobile endpoints?

AnQiCMS: Providing seamless PC and mobile end adaptive display solutions for your website In today's digital age, it is common for users to access websites through various devices, from large computer screens to small smartphones, and the display effect of the website directly affects user experience and the efficiency of information transmission.A website that cannot be displayed friendliness on mobile devices will undoubtedly lose a large number of potential users and business opportunities.AnQiCMS fully understands this requirement and has provided flexible and diverse solutions to ensure that your website content is perfectly presented on both PC and mobile ends

2025-11-08

How to use AnQiCMS built-in tags to control content display logic?

In AnQiCMS, the built-in tag system is the core tool you use to control the logic of displaying website content.It provides a powerful and flexible syntax that allows you to control the acquisition, filtering, sorting, formatting, and final layout of content in template files without writing complex backend code.This system is similar to the Django template engine syntax, easy to use, and can help you convert technical details into intuitive display effects.

2025-11-08

How does AnQiCMS filter and display content based on article recommendation attributes (such as headline, recommended)?

In content operation, effectively highlighting and displaying important articles is the key to improving user experience and guiding traffic.AnQiCMS (AnQiCMS) fully understands this point, therefore, it provides a flexible article recommendation feature, allowing you to mark it based on the importance of the content or specific use, and accurately filter and display it on the website front end.

2025-11-08

How to implement pagination functionality for article or product lists in AnQiCMS templates?

How to implement pagination for article or product lists in AnQiCMS template?For any content management system, effectively managing and displaying a large amount of content is a core requirement.When the number of articles or products on a website increases day by day, if there is no reasonable pagination mechanism, users may feel tired while browsing, and the website's loading speed may also be affected.

2025-11-08

How does AnQiCMS allow search results to be paginated on the page?

In AnQiCMS, implementing pagination for the website's search results is an important function for improving user experience and optimizing the website structure.AnQiCMS's powerful template tag system makes this process intuitive and efficient.By reasonably utilizing the `archiveList` and `pagination` core tags, you can easily build a functional search results page.

2025-11-08

How can articles be sorted by views in the AnQiCMS template?

In AnQiCMS, content management is not limited to publishing and organizing, how to effectively display these contents, especially placing popular articles in prominent positions, is the key to improving user experience and website activity.This article will introduce in detail how to sort the article list by views in the AnQiCMS template, making hot content naturally stand out.

2025-11-08