As an experienced CMS website operation person, I know that the flexibility and powerful functions of content management system tags are the key to efficient content operation.archiveList标签作为AnQiCMS中用于获取文档列表的核心工具,其参数的精妙运用能帮助我们精确地呈现所需内容,无论是构建网站首页的推荐文章,还是在分类页面展示特定文档,乃至在详情页提供相关推荐,都离不开对这个标签的熟练掌握。
archiveListLabel Overview
archiveListLabels play a key role in AnQiCMS in obtaining the document list.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 variety of content display blocks to meet the needs of different pages and users.{% archiveList 变量名称 with 参数 %}and{% endarchiveList %}between, and loop (usually)forto traverse the obtained 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.archiveListTagged throughmoduleIdandcategoryIdParameters provide basic and powerful filtering capabilities.
moduleIdThe parameter is used to specify the content model ID to be retrieved for the document list. For example, if your website has article models and product models, by settingmoduleId="1"You can only get articles, andmoduleId="2"This method retrieves the product only. 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, for examplecategoryId="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 specifycategoryId,The system will try to read automatically. However, if you wish to explicitly not read the current category ID, you can usecategoryId="0"to avoid automatic association. To further refine the filtering,excludeCategoryIdThe parameter allows you to exclude one or more category IDs, ensuring that documents under certain categories do not appear in the list.
In addition,childParameters are crucial for managing the display of content under category hierarchies. By default,childresponse fortrueThis 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 documents for the current specified category (without child categories), you can set it tochild=false.
Using recommended attributes for content curation
AnQiCMS provides rich recommendation attributes (flag) to mark documents, which are powerful tools for content curation and highlighting important information in content operations.archiveListTagsflagThe parameter can accurately filter documents based on these properties.
Each recommended attribute corresponds to a specific letter:
- Top News[h]: Used for the most important and prominent content on the website.
- [en]: Recommended [c]: English common recommendation content, commonly seen in various recommendation positions.
- Slide[f]: Usually used for carousel or slideshow display content.
- Recommended [a]: Especially recommended content with higher priority than common recommendations.
- [en]: Scroll[s]: 适用于滚动新闻、公告等动态展示。
- 加粗[h]: 在列表中可能以加粗样式显示,强调标题。
- [en]: Image [p]: 含有重要图片,可能在图片展示区域出现。
- Jump [j]: Content may be an external link or an in-site jump.
By settingflagparameters, such asflag="c", You can easily extract all documents marked as "Recommended". At the same time,excludeFlagParameters can help you exclude documents with specific recommendation properties, such asexcludeFlag="j"It can avoid the jump type document appearing in the regular list. If you need to explicitly display the recommended attributes of each document in the front-end list items,showFlag=truethe parameters will be included in the document dataFlagfield.
In addition to recommended properties, you can alsouserIdobtain documents published by specific authors using parameters, which is especially useful for operating personal blogs or multi-author platforms.parentIdThe parameter allows you to get the child documents under the specified parent document, which is very convenient when building a document structure with parent-child relationships.
Control of sorting, quantity, and display type
archiveListThe label provides flexible control options to determine the order, quantity, and list type of the document presentation.
orderThe parameter is used to specify the sorting rules of the document. Common sorting methods include:
order="id desc":Sorted in descending order by document ID, usually meaning that the most recently published documents are at the top.order="views desc":According to the document views in descending order, used to display popular documents.order="sort desc":According to the descending order of the custom sorting field in the background, providing manual adjustment flexibility for operators.
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,limit="2,10",represents starting from the 2nd document, fetching the next 10 documents.
typeThis parameter determines the display behavior of the list:
type="list"is used for the conventional document list display, showing onlylimitParameter specified quantity.type="page"Used for document lists requiring pagination functionality, it is usually combined withpaginationtags to generate pagination navigation.type="related":专门用于获取相关文档。在这种模式下,标签会根据当前文档的上下文(如分类、关键词)智能地获取相关内容。related类型还支持likeparameter, such aslike="keywords"It will retrieve relevant documents based on the keywords in the document.like="relation"It will then display the relevant documents manually set up on the backend.
Whentype="page"whenqThe parameter will take effect. It allows you to specify keywords (such asq="seo")to search for document titles that contain this keyword. Even smarter is that if the URL already contains a parameter namedqQuery parameters,archiveListit will automatically read and apply it to the search filter.
Advanced Filtering and Multi-Site Content Integration
In addition to the aforementioned 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.archiveListIt can dynamically filter documents based on these parameters. For example, if your content model has a custom field namedsexyou can filter allsex=男documents by using URL parameterssexThe document field is “Male”.
For operations teams that have deployed multiple websites,siteIdThe parameter is the key to cross-site content calls. Usually, it is not necessary to fill in manually, but when you need to display content from another site on a site, specifysiteIdIt can achieve accurate data calling.
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.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 named)item)All of them include rich fields, such as:
item.Id: Document IDitem.Title: Document Titleitem.Link: Document Linkitem.Description:Document Descriptionitem.Thumb:The document thumbnail addressitem.Logo:The document cover first image addressitem.Views:Document Viewsitem.CreatedTime:The document publication timestamp (can be used with)stampToDateFilter formatting)item.CategoryId:Category IDitem.Flag:Document recommendation attributes (required)showFlag=true)
By these fields, you can flexibly build the display style of the document list. For example, using{{stampToDate(item.CreatedTime, "2006-01-02")}}You can format the timestamp to date,{{item.Thumb}}Can display a thumbnail of the document.
In actual operation:archiveListApply
In the actual operation of websites,archiveListThe application scenarios of tags are very extensive:
- Home page 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:Combine
qDynamic display of parameters showing the relevant documents searched by the user. - Document details page:Get relevant documents of the same category or keywords to increase user stay time.
- Special topic page:Aggregate specific
flagdocuments of properties to form special content.
skilled inarchiveListTags and their various parameters will enable you to operate AnQiCMS content like a fish in water, whether you are building complex business websites or operating personal media, you can manage and present content more efficiently and accurately.
Frequently Asked Questions
Q1: How toarchiveListget multiple categories of documents at the same time?
**A1