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