How to get the documents of a specified user, or only display the documents under the current category without including subcategories?

Calendar 👁️ 64

As an experienced website operations expert, I am well aware of the importance of a flexible and efficient content management system for website operations.AnQiCMS, with its lightweight, high-performance, and highly customizable features, has won the favor of many small and medium-sized enterprises and content operators.In the daily content operation, we often need to manage and display the website content in a refined manner, among which, how to accurately obtain the documents of a specific author, or only display the content under the current category while excluding the subcategories, is the key to improving user experience and optimizing the content structure.Today, let's delve deeperarchiveListThese two powerful functions of the tag.

Security CMSarchiveListDeep analysis: Accurately obtain documents and flexible classification control.

In AnQi CMS,archiveListThe tag is undoubtedly the core of content display. It acts as a powerful filter, helping us extract documents that meet specific conditions from a vast amount of content (including articles, products, etc.), and present them in various forms on the website front end.Whether it is to display the latest news, hot products, or build complex special pages,archiveListThey all play an indispensable role. It follows the concise syntax of the Django template engine, through{% tag %}to define tags,{{ variable }}to output variables, making template development intuitive and efficient.

By default, we may simply callarchiveListto get the latest document list under a certain model:

{% archiveList archives with moduleId="1" type="list" limit="5" %}
    {% for item in archives %}
        <li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
    {% empty %}
        <li>暂无文档。</li>
    {% endfor %}
{% endarchiveList %}

However, the strength of AnQi CMS is far from over. When we need to control the content source more finely,userIdandchildthese two parameters can play their unique role.

I.驾驭内容发布者:userIdThe magic of parameters

In a multi-user or multi-author collaboration website environment, such as a blog written by multiple experts or a platform showcasing works of different creators, we may need to list all the documents published by a specific author individually. At this point,archiveListofuserIdThe parameters come into play.

userIdParameters allow us to specify a user ID,archiveListIt will only return all the documents published under the user ID. This is extremely useful for building personal author columns, showcasing edited featured content, or for the convenience of users to view their own published content.The user ID is usually a unique identifier assigned by the Anqicms backend to each administrator or content publisher.

Imagine, in a blog named "Science Exploration", the user ID is:1The author is "Dr. Zhang", the user ID is:2The author is "Li Engineer". If we want to display all the articles of "Zhang Doctor" on a specific page, we just need to use it like this.userIdparameters:

{% archiveList archives with userId="1" moduleId="1" type="list" limit="5" %}
    {% for item in archives %}
        <li>【作者 ID: {{ item.UserId }}】<a href="{{ item.Link }}">{{ item.Title }}</a></li>
    {% empty %}
        <li>该作者暂无文档发布。</li>
    {% endfor %}
{% endarchiveList %}

In this way, we can easily create a personal homepage for each author, dynamically displaying their portfolio, greatly enhancing the organization and personalization of the content.This also helps to establish the personal brand of the author and enhance the sense of belonging and stickiness of users.

II. Precision Focusing on Classification: childThe magic of the parameter

The AnQi CMS content classification system usually supports a hierarchical structure, for example, under 'News Center' there may be subcategories such as 'Company News' and 'Industry Dynamics'. In many cases, we need to display all the content of the parent category page, including the documents of the subcategories, which is alsoarchiveListThe default behavior of the label (childThe parameter is set to default.true)。However, sometimes our operational goal is to let users focus only on the content of the current parent category itself, while ignoring the documents of its subcategories, in order to achieve a more accurate topic focus.

At this time,childParameters are particularly crucial. When wechildthe parameter tofalsethen,archiveListWill only retrieve the specifiedcategoryIdDocument under, without including any sub-category documents.

For example, if the "News Center"'categoryIdIs10The company news is10The subcategory, if we want to display only the documents directly published to the 'News Center' category on the 'News Center' page and not show any 'Company News' or other subcategory documents, we can configure it this wayarchiveList:

”`twig {% archiveList archives with categoryId=“10”

Related articles

How to determine if a document belongs to the current page category in the `archiveList` loop?

As an experienced website operations expert, I know that the flexible use of templates in content management systems is the key to enhancing the dynamism of websites and user experience.AnQiCMS (AnQiCMS) provides us with powerful content display capabilities with its efficient architecture based on the Go language and Django-style template syntax.Today, let's delve into a very practical template technique: how to cleverly determine whether the current document belongs to the current page category within the `archiveList` loop.

2025-11-06

How to iterate over and display each filter parameter's optional values and their corresponding links for the `archiveFilters` tag?

Good, as an experienced website operation expert, I am happy to delve into the exquisite features of the `archiveFilters` tag in AnQi CMS and guide you on how to flexibly apply it in practice to build a beautiful and practical content filtering function. --- ## Deep Analysis of AnqiCMS: `archiveFilters` tag, building a dynamic content filtering tool In the world of content management, how to help users quickly find the information they need is the key to improving website experience and conversion rates.Deeply understands this path of AnQi CMS

2025-11-06

How to create a document filtering interface with the `archiveFilters` tag?

AnQi CMS is an efficient and customizable enterprise-level content management system, dedicated to providing powerful and flexible content management tools for website operators.In daily operations, we often need to provide users with a diverse range of content filtering functions to help them quickly find the information they are interested in.At this time, the `archiveFilters` tag provided by AnQi CMS can fully display its capabilities, allowing us to easily build a multi-condition document filtering interface, greatly enhancing the user's content discovery experience.### Understand `archiveFilters`

2025-11-06

How to get the custom model field content of the `archiveDetail` tag?

In the powerful and flexible AnQiCMS content management system, the content model plays a core role, allowing us to build various personalized content structures according to business needs.Whether it is articles, products, activities, or other custom information, we can define unique fields for them.How can you elegantly present these rich custom field contents on the front-end page, which has become the key to template development.

2025-11-06

How does AnQiCMS's document content collection and batch import function improve the efficiency of content construction?

## AnQiCMS: Content collection and batch import, how to drive the leap in content construction efficiency?In today's digital age, website content has become the core of communication between enterprises and users, brand building, and search engine optimization.However, starting from scratch, creating, managing, and updating a massive amount of content is a continuous and time-consuming task for any website operator.The cumbersome collection of materials, manual input, and repeated adjustments not only consume a lot of human and material resources, but may also miss valuable market opportunities.

2025-11-06

How to use AnQiCMS advanced SEO tools (such as Sitemap, Robots.txt) to improve the visibility of a website in search engines?

## Optimize Your Search Engine Footprint: How AnQiCMS Harnesses Sitemap and Robots.txt to Improve Website Visibility In the ever-changing digital world, the search engine visibility of a website is the foundation of its success.No matter if you are running a small and medium-sized enterprise, a self-media platform, or managing multiple sites, ensuring that your content can be discovered and effectively indexed by search engines is crucial for traffic acquisition and brand exposure.

2025-11-06

How does AnQiCMS handle the management of pseudo-static and 301 redirection to solve the problem of URL structure optimization and traffic loss?

## AnQiCMS' Static URL and 301 Redirect: A Smart Solution for URL Optimization and Traffic Protection In the digital wave, a website's URL (Uniform Resource Locator) is far more than a simple address.It is not only the path that users access the page, but also the key clue for search engines to understand the content of the website and evaluate its value.A clear and semantically friendly URL can significantly enhance user experience, improve search engine crawling efficiency and ranking performance.

2025-11-06

How to create custom fields for different content models (such as articles, products) in AnQiCMS?

Good, as an experienced website operation expert, I am very willing to deeply analyze the powerful functions and actual operations of the customized fields in AnQiCMS. --- ## In AnQiCMS, create custom fields for different content models: unlock the powerful engine of personalized content In the era where content is king, the diversity and personalization of website content are key to attracting and retaining users.A remarkable content management system (CMS) should never limit you to a fixed content structure.AnQiCMS understands this way

2025-11-06