How to fetch the document list according to category ID, recommendation attributes, etc. for the `archiveList` tag?

Calendar 👁️ 67

As an experienced CMS website operation personnel of AnQi, I am well aware that the flexibility and powerful functions of the content management system tags are the key to efficient content operation.archiveListThe tag serves as the core tool in AnQiCMS for retrieving document lists. The exquisite use of its parameters can help us accurately present the desired content, whether it is to build recommended articles for the homepage, display specific documents on category pages, or provide relevant recommendations on detail pages, it is indispensable to master this tag.

archiveListLabel overview

archiveListTags play a key role in AnQiCMS in obtaining document lists.It allows operators to filter, sort, and display document content on the website based on various conditions.By reasonably configuring its parameters, we can build a rich and diverse content display block to meet the needs of different pages and users.The basic usage of this tag is to wrap it around{% archiveList 变量名称 with 参数 %}and{% endarchiveList %}between, and iterate (usually in a loop) over the retrieved document dataforloop to iterate over the retrieved document data.

Document filtering based on classification and model

In content management, documents usually belong to specific content models (such as articles, products) and categories.archiveListTag throughmoduleIdandcategoryIdParameters provide basic and powerful filtering capabilities.

moduleIdThe parameter is used to specify the content model ID to retrieve the document list. For example, if your website has an article model and a product model, by settingmoduleId="1"you can only retrieve articles, andmoduleId="2"This method retrieves only the product. This ensures the accuracy of the content type and avoids confusion between content from different models.

categoryIdThe parameter allows you to retrieve documents under a specific category. You can specify a single category ID, such ascategoryId="10", or you can specify multiple category IDs separated by commas, such ascategoryId="10,12,15"To get all documents under these categories. If you want to get the document list of the category belonging to the current page, it is usually not necessary to specifycategoryIdThe system will attempt to read automatically. However, if you wish to explicitly prevent reading the current category ID, you can usecategoryId="0"to avoid automatic association. To further refine the filter,excludeCategoryIdThe parameter allows you to exclude one or more category IDs, ensuring that documents under certain categories do not appear in the list.

Furthermore,childParameters are crucial for managing the display of content under category hierarchies. By default,childWithtrueThis means that when you specify a parent category ID, the list will include the parent category and all documents under its child categories. If you only want to display the documents of the current specified category (without its subcategories), you can set it tochild=false.

Utilize recommended attributes for content curation

AnQiCMS provides rich recommendation properties (flag) to mark documents, these properties are powerful tools for content curation and highlighting important information in content operations.archiveListlabel'sflagThe parameter can accurately filter documents based on these properties.

Each recommended attribute corresponds to a specific letter:

  • Headline[h]: Used for the most important, most prominent content on the website.
  • Recommended[c]: General recommended content, commonly seen in various recommendation positions.
  • Slide[f]: Usually used for carousel or slide show content.
  • Special recommendation[a]: Particularly recommended content with higher priority than general recommendations.
  • Scroll[s]: Suitable for scrolling news, announcements, and other dynamic displays.
  • Bold[h]: May be displayed in bold style in the list to emphasize the title.
  • Image[p]: Contains important images and may appear in the image display area.
  • Jump [j]: The content may be an external link or an in-site jump.

By settingflagparameters, for exampleflag="c"You can easily extract all documents marked as 'recommended'. At the same time,excludeFlagParameters can help you exclude documents with specific recommended properties, such asexcludeFlag="j"You can avoid jump-type documents appearing in the regular list. If you need to explicitly display the recommended properties of each document in the front-end list items,showFlag=truethe parameters will be included in the document dataFlagfield.

In addition to recommended attributes, you can alsouserIduse parameters to retrieve documents published by specific authors, which is especially useful for operating personal blogs or multi-author platforms.parentIdParameters allow you to retrieve child documents under specified parent documents, which is very convenient when building document structures with parent-child relationships.

Sorting, quantity, and display type control

archiveListLabels provide flexible control options to determine the presentation order, quantity, and list type of the document.

orderParameters are used to specify the sorting rules for the document. Common sorting methods include:

  • order="id desc": Sorted in descending order by document ID, usually meaning the most recently published documents are at the top.
  • order="views desc": Sorted in descending order by document views, used to display popular documents.
  • order="sort desc": Sort in descending order according to the custom sorting field on the backend, providing operators with the flexibility to manually adjust the order.

limitParameter controls the number of documents displayed in the list. For example,limit="10"Only the first 10 documents will be displayed. It also supports offset mode, such aslimit="2,10"which means starting from the second document and getting the next 10 documents.

typeThe parameter determines the display behavior of the list:

  • type="list"Used for displaying a document list conventionally, only showinglimitthe number of items specified by the parameter.
  • type="page"Used for document lists that require pagination, usually combined withpaginationtags to generate pagination navigation.
  • type="related"Used to retrieve relevant documents. In this mode, tags will intelligently retrieve relevant content based on the context of the current document (such as categories, keywords).relatedThe type also supportslikeparameters such aslike="keywords"It will retrieve relevant documents based on the keywords of the document, andlike="relation"it will display the relevant documents manually set up in the background.

Whentype="page"then,qthe parameter can take effect. It allows you to specify keywords (such asq="seo"Search for document titles containing this keyword. Even smarter is that if the URL already contains a namedq.archiveListit will automatically read and apply it to the search filter.

Advanced filtering and multi-site content integration

In addition to the above features,archiveListit also supports more advanced filtering and multi-site management capabilities.

The "Custom Filter Parameters" feature is very powerful, it allows you to use custom fields in the background content model for filtering. Simply define the fields that can be filtered in the additional document configuration, and then attach these fields as URL query parameters to the page link.archiveListCan dynamically filter documents based on these parameters. For example, if your content model has a custom field namedsexyou can filter all by using URL parameterssex=男to filter out allsexDocument with field 'Male'.

For operation teams that have deployed multiple websites.siteIdThe parameter is the key to cross-site content calls. Generally, it does not need to be filled in manually, but when you need to display content from another site on a site, specifysiteIdAchieve precise data calls.

combineIdandcombineFromIdThis field is designed for special combination scenarios. They allow you to combine multiple document data into a list and generate unique links and titles.For example, when constructing a travel route from location A to location B,combineIdIt can help you combine the "A location" document with the "B location" document in the list, so that both pieces of information are displayed in the title and a URL containing both IDs is generated.

Access document data in the template

WhenarchiveListAfter the tag successfully retrieves the document list, you canforAccess the specific data of each document object in the loop. Each document object (usually nameditemFields such as these are rich, for example:

  • item.Id:Document ID
  • item.Title:Document title
  • item.Link:Document link
  • item.Description: Document description
  • item.Thumb: Document thumbnail address
  • item.Logo: Document cover first image address
  • item.Views: Document views
  • item.CreatedTime: Document publish timestamp (can be配合}stampToDateFilter formatting
  • item.CategoryId: Category ID
  • item.Flag: Document recommendation attributes (requiredshowFlag=true)

You can flexibly build the display style of the document list with these fields. For example, using{{stampToDate(item.CreatedTime, "2006-01-02")}}Can format timestamps into dates,{{item.Thumb}}Can display document thumbnails.

In actual operation,archiveListapply

In the actual operation of the website,archiveListThe application scenarios of tags are very extensive:

  • Homepage of the website:Used to display the latest articles, hot products, selected recommendations, and other modules.
  • Category page:List all documents under a specific category and support pagination and filtering.
  • Search results page:CombineqDynamically display the relevant documents found by the user.
  • Document detail page:Obtain relevant documents of the same category or keywords, increasing user stay time.
  • Special page:Aggregate specificflagThe document of the property, forming a special topic content.

Proficient in masteringarchiveListTags and their parameters will make you swim like a fish in the content operation of AnQiCMS, whether you are building a complex commercial website or operating personal media, you can manage and present content more efficiently and accurately.


Frequently Asked Questions

Q1: How toarchiveListget documents from multiple categories at the same time?

**A1

Related articles

How to use similar Django variable and tag syntax in AnqiCMS templates?

As a senior security CMS website operation personnel, I know the core position of content in the digital age.An efficient content management system, especially its template function, is the foundation to ensure that website content can be presented flexibly and accurately to readers.The AnQi CMS excels in this aspect, drawing on the mature Django template engine syntax, allowing content creators and template developers to build pages in an intuitive and powerful way.### AnQi CMS template engine's Django-style grammar overview AnQi CMS template engine is designed cleverly

2025-11-06

What are the basic conventions and directory structure specifications for AnqiCMS template creation?

Hello! As an experienced AnQiCMS website operator, I am very happy to share with you the key knowledge about AnQiCMS template creation.In my daily work, the reasonable planning and precise application of templates are the foundation for ensuring the efficient display of content and improving user experience.A deep understanding of the basic conventions and directory structure specifications of AnQiCMS templates not only allows us to create and publish content more smoothly, but also lays a solid foundation for the long-term maintenance and optimization of the website. Next

2025-11-06

What are the mainstream search engines supported by AnqiCMS's link push function?

As an experienced website operator, I am well aware of the importance of timely inclusion after content publication for website traffic and SEO performance.AnQiCMS (AnQiCMS) provides many conveniences in content management, among which the link push function is a key factor in helping website content be quickly discovered by search engines.This article will introduce in detail the link push function supported by Anqi CMS, including the main search engine types and their configuration methods, aiming to help website operators better utilize this feature and improve the inclusion efficiency of the website.###

2025-11-06

How does AnqiCMS support Markdown editor and display mathematical formulas and flow charts?

AnqiCMS as an efficient and customizable content management system, has always been committed to providing convenient and powerful creation tools for content operators.In daily content operations, we know that high-quality, clear, and expressive content is the key to attracting and retaining users.For this, AnqiCMS has continuously evolved and now fully supports Markdown editors, can elegantly present complex mathematical formulas and intuitive flowcharts, greatly enriching the dimensions of content expression, and making our website stand out in the sea of information

2025-11-06

How to get the detailed information of a specified document, including custom fields, using the `archiveDetail` tag?

In the daily operation of AnQi CMS, obtaining and displaying detailed information of website content is one of the core tasks.The `archiveDetail` tag is a powerful tool specifically designed for this purpose in the Anq CMS template system, allowing us to flexibly extract detailed data from any specified document, including standard document properties and user-defined field content.

2025-11-06

How to get the category list and detailed information of a single category with the `categoryList` and `categoryDetail` tags?

As a senior AnQi CMS website operation personnel, I know that the flexibility of content organization and presentation is crucial for attracting and retaining users.The site classification structure is not only the skeleton of content, but also an important path for users to explore and discover information.Today, let's delve deeply into the two core template tags in Anqi CMS, `categoryList` and `categoryDetail`, and how they help us efficiently obtain and display category lists and individual category details.## Flexible Construction of Category Navigation: `categoryList`

2025-11-06

How to display all tags and document lists under tags in `tagList` and `tagDataList` tags?

As an experienced website operator who deeply understands the operation of Anqi CMS, I fully understand the core role of content organization and user experience in the success of a website.Tags are the important bridge connecting these two, they not only help us effectively classify and manage a vast amount of content, but also guide users to quickly find the information they are interested in.In Anqi CMS, the `tagList` and `tagDataList` template tags are the key tools to achieve this goal, allowing us to flexibly display tags and associated documents under the tags on the website front-end.###

2025-11-06

How to implement pagination display and style control for document list using the `pagination` tag?

As a website operator who deeply understands the operation of AnQiCMS, I know the subtle art of content presentation lies in how to efficiently and elegantly serve users.For a document list page containing a large amount of content, a reasonable pagination mechanism not only improves user experience but also optimizes website performance.In AnQiCMS, the `pagination` tag is the core tool to achieve this goal, allowing us to flexibly control the pagination display and style of the document list.

2025-11-06