How does the `child=false` parameter affect the display of categories and their subcategories when retrieving the document list?

Calendar 👁️ 70

In AnQi CMS,archive/listThe interface is the core tool for obtaining the list of website documents, it provides a variety of parameters to help us accurately filter and display content. Among them,childParameters may seem simple, but they play a crucial role in the display of documents in categories and their subcategories, directly affecting the granularity of content presentation.Understand and make good use of this parameter, which can make the organization of your website content clearer and improve the user experience.

By default, when you go througharchive/listWhen the interface retrieves documents under a certain category,childthe value of the parameter is set totrueThis means that the system will not only return the documents contained in the category itself, but will also automatically include all subcategories and even grandchild categories.For example, if your website has a 'News Center' category, it will have two subcategories, 'Domestic News' and 'International News'.When you are requesting the document list of the "News Center", ifchildthe parameter is set to the defaulttrueThen all the articles under 'domestic news' and 'international news' will be displayed together.This pattern is very suitable for situations where it is necessary to fully display all related content under a certain theme, allowing users to browse a wider range of information on a single page.

However, in some scenarios, we may need more precise content control. At this point,child=falseParameters come into play. When you willchildThe parameter is explicitly set tofalsethen,archive/listThe behavior of the interface will change significantly. It will strictly limit the range of returned documents, only including those that directly belong to the category you specify, and completely excluding any content from any subcategories.

Continue with the above "News Center" example, if you want to create a dedicated list of "Special Reports" or "Editor's Picks" documents under the "News Center" parent category that do not belong to any subcategory (such as "Domestic News" or "International News"), just set the parameters when calling the interfacecategoryIdFor the ID of the 'News Center' and simultaneously passed inchild=false. The result will only be articles directly published at the "News Center" level, and will not mix in any content from "Domestic News" or "International News."}

This fine-grained control capability brings greater flexibility to website operations. When you want a category page to serve as an aggregation entry for all its subcategory content, maintainchild=true(or not passing this parameter) is **optional. For example, a "product" category page may need to display all product lines' documents, regardless of which sub-series they belong to.On the contrary, if you want a category page to only display its own distinctive content, as an independent thematic area, and not to be diluted by the content of subcategories, then setchild=falseIt will be an ideal solution. This helps create more focused and targeted pages for each category, avoid information overload, and improve the efficiency of content discovery for users in specific categories.It also applies to creating a 'pure' content page for a certain parent category in the navigation menu, ensuring that the content of this page is distinct from that of the subcategories.

In summary, of Anqi CMS'schildThe parameter is inarchive/listThe interface provides powerful control over the display range of the document list.child=true(Default value) used for broad display, including sub-category content; andchild=falseIt is used for deep focus, displaying only the direct content of the current category.According to your website content structure and operational needs, flexibly using this parameter can effectively optimize the content organization and user browsing experience of the website.

Frequently Asked Questions (FAQ)

  • Q1: Usechild=falseAfter, if I want to display documents from multiple specific categories (including some parent categories and some child categories) at the same time, what should I do?A1: In this case, you need tocategoryIdPass multiple category IDs in the parameter, separated by commas. For example,categoryId="1,5,10"The system will return the direct documents under the categories with ID 1, 5, 10. Please note that even if you pass the parent category ID, due tochild=falseThe function, it will only return the documents directly contained in the parent category, and will not automatically include the documents in its subcategories.
  • Q2:child=falseWill the parameter affect?type="related"What is the list of documents under the mode?A2:child=falseThe parameter mainly targets throughcategoryIdTo limit the document scope of the list query. Intype="related"In this mode, the system will search for related documents based on the specified document ID, with its logic focusing more on the document itself rather than strict classification levels. Therefore,child=falseparameter pairtype="related"Patterns usually have no direct impact.
  • Q3: How do you know if a category has subcategories, so you can decide whether to use it?child=false?A3: You can usecategory/listAn interface to get the category list. By checking theparent_idfields in the returned data, you can construct theidhierarchical relationship of categories. If a categoryparent_idIn this case, it is a parent category with subcategories, and you can decide whether to use it when querying the parent category according to your needschild=false.

Related articles

How to get the document list with 'Headline' or 'Slide' recommended attributes (`flag`) in AnQiCMS?

In AnQiCMS (AnQiCMS), content managers often need to flexibly display important content on the website, such as setting specific articles as 'headline' or 'slideshow' to attract users' attention.The AnQi CMS provides a very practical feature, that is, marking documents through the 'recommended attribute' (flag).If you want to get the list of documents marked specially, the AnQiCMS API interface can help you achieve it easily.

2025-11-09

Does the AnQiCMS document list interface support excluding multiple categories of documents at the same time (`excludeCategoryId` usage)?

In website operation, we often need to flexibly display content, such as displaying the latest articles on a page, but not including content under certain specific categories, such as announcements or internal news.AnQiCMS as a powerful content management system, provides a rich set of API interfaces to meet these complex display requirements.Today, let's delve into a very practical parameter of the `archive/list` interface: `excludeCategoryId`, especially how it supports excluding multiple categories of documents.###

2025-11-09

How to filter the AnQiCMS document list to display articles under a specific category (`categoryId`)?

How to accurately filter out articles under specific categories when managing and displaying a large amount of content in Anqi CMS is a key link to improve the organization of website content and user experience.Strong and flexible interfaces are provided by AnQi CMS, allowing us to easily achieve this goal.This article will provide a detailed introduction on how to use the document list interface of Anqi CMS to only display specific categorized articles that you hope to see.### Master the document list interface: the core of content filtering To filter articles under specific categories, we need to use the `/api/archive/list` interface provided by AnQi CMS

2025-11-09

How to implement descending order by publish time, view count, or update time in the AnQiCMS document list?

In website operation, how to efficiently present content lists so that users can quickly find the information they are most interested in or most valuable is an important issue.AnQiCMS provides a flexible document list feature, allowing us to easily implement content list sorting in descending order based on multiple conditions, such as publication time, page views, or update time.This not only optimizes the user experience, but also helps to improve the visibility and interaction of the content.

2025-11-09

How to use the `q` parameter to perform keyword search in the AnQiCMS document list and realize the in-site search function?

In the daily operation of a website, providing users with an efficient and convenient in-site search function is a key factor in improving user experience and guiding content discovery.For those of us using AnQiCMS to manage website content, it is not difficult to achieve this function.AnQi CMS provides a very practical parameter——`q`, which allows us to easily search for keywords in the document list.### Start the in-site search journey: Understanding the `q` parameter In the AnQiCMS document list interface (/api/archive/list), `q`

2025-11-09

How to handle the `extra` field returned by the `archive/list` interface to obtain custom field information?

When using AnQi CMS for website content management, we often need to display more personalized data beyond the usual information such as title, summary, thumbnail, etc.This additional information, such as the author of the article, the model of the product, the release location, etc., is achieved through the powerful custom field function of Anqi CMS.How can we elegantly extract and utilize these custom fields when we obtain the document list through the `archive/list` interface on the front end?The answer is hidden in the `extra` field of the returned data

2025-11-09

In the AnQiCMS document list, what do the `images`, `logo`, and `thumb` fields represent, and how should they be used?

When using AnQi CMS to manage website content, we often encounter scenarios involving image upload and display.In the data structure of documents (articles, products, etc.), categories, and even single pages, the `images`, `logo`, and `thumb` fields play different roles. They work together to support the effective presentation and performance optimization of the website's visual content.Understanding their specific purposes can help us better plan content and optimize the user experience.### `images` : multi-image display and rich content `images`

2025-11-09

How to build pagination navigation for AnQiCMS document list on the front-end page (using `page` and `total` parameters)?

When displaying a large number of documents on the website frontend, pagination navigation is a key feature for improving user experience and managing data loading efficiency.AnQiCMS (AnQiCMS) provides a powerful and flexible API interface, allowing you to easily implement pagination of document lists on the front end.This article will introduce in detail how to use the `page` and `total` parameters in the `archive/list` interface to build a fully functional pagination navigation.--- ### Understanding the core of AnQi CMS pagination mechanism To build pagination navigation for the document list

2025-11-09