In website operation, especially when managing pages that require a large amount of content display, such as article lists and product display pages, how to efficiently control the number of items displayed per page directly affects user experience and page loading speed.AnQiCMS provides a flexible and powerful mechanism to meet this need, it allows you to customize the display of each page according to different pages and content types through fine-grained control at the template tag level.
The AnQi CMS can provide this flexibility because it closely integrates the display logic of list content with template design.Not like some CMS may provide a global backend setting, Anqi CMS is more inclined to let you decide the specific behavior of each list when designing templates.The benefits of this design lie in the fact that you can set a small amount of content for the hot recommendation area on the homepage, and more content for the special topic list page, while also providing pagination for the related product list, truly realizing a personalized display of 'thousand stations, thousand faces'.
The core implementation mainly revolves around several key template tags, among which the most commonly used isarchiveListA tag that is responsible for calling a list of 'document' type contents such as articles or products. When you need to control the number of items displayed per page, archiveListlabel'slimitAn attribute is particularly important. For example, if you want to display 10 articles or products per page, just set it in the template forarchiveListtagslimit="10"properties.
just setlimitAn attribute, which usually only displays a fixed amount of content. If you not only want to limit the number of items displayed per page, but also need to generate 'Previous page', 'Next page', and specific page number navigation at the bottom of the page, then you need to cooperate witharchiveListThe other attribute of the tagtype="page". WhentypeSet to"page"then,archiveListNot only will it load the content of the current page according tolimitThe specified quantity, but it will also pass the total number of pages of the entire list, the current page number, and other pagination information to the system.
After that, you can usepaginationtags to receive these pagination data and render the full page number navigation on the page. By usingpaginationLabel, you can easily implement such features as displaying how many adjacent page numbers (show="5"), as well as common pagination elements such as 'Home', 'End', 'Previous', 'Next', etc., greatly enhances the convenience of users browsing a large amount of content.
exceptarchiveListLabel, similar content list tags in AnQiCMS, such astagDataList(Used to display a list of articles or products associated with a tag) andcommentList(Used to display the comment list), also follow the samelimitandtype="page"property rules to control the number of items displayed per page and pagination logic.
This setting method based on template tags gives website design and operation a high degree of freedom. For example, you may want to display the latest 5 articles in the article recommendation module on the homepage without pagination, and you just need to use{% archiveList archives with limit="5" %}And in a dedicated article category page, you may need to display 15 articles per page and provide complete pagination navigation, then you will use{% archiveList archives with type="page" limit="15" %}and pair with{% pagination pages %}.
Furthermore,limitThe property also supports a more advanced usage, namely bylimit="offset,count"The form, for examplelimit="2,10"This means the system will skip the first 2 items in the list and then display the next 10 items starting from the 3rd item.This is very useful for displaying several specially recommended items at the top of the page, and then displaying the rest of the content in a paginated form, making the layout more flexible and diverse.
In summary, AnQi CMS, through its powerful template tag system, delegates the control of displaying the number of articles or products per page to the template designer. Whether it's a simple content quantity limit or a complex content list with pagination features, it can be flexibly applied.limit/type="page"as well aspaginationTags can be easily implemented, thus providing users with a better browsing experience and helping website operators to better plan content display strategies.
Frequently Asked Questions (FAQ)
Q1: Does AnQi CMS have a global setting that can modify the number of items displayed per page for all lists at once?A1: The design philosophy of Anqi CMS is to provide high flexibility.Therefore, there is no unified global setting to control the number of items displayed per page in all content lists.This setting usually requires you to configure it in the template files of the website, separately for different content lists (such as article lists, product lists, tag lists, etc.), by modifying the corresponding template tags.limitTo implement properties. This method, although it requires some template editing operations, ensures that each list can be optimized according to its specific needs.
Q2: If I only want to display the latest/hottest few articles or products in a module without pagination, how should I set it up?A2: In this case, you just need to usearchiveList(or other content list tags liketagDataList)的limitProperty, and specify the number you want to display without adding anythingtype="page"Property. For example,{% archiveList archives with limit="5" order="views desc" %}It will display the top 5 articles or products with the highest views without generating any pagination navigation.
Q3:categoryListandpageListDoes the tag support pagination of display content?A3: categoryList(Category list) andpageList(Single page list) The tag'slimitProperties are mainly used to control the display quantity of themselves (i.e., categories or single pages), such as how many top-level categories are displayed.They do not provide direct in-page pagination functionality for articles or single-page content under the category.If you need to display articles or products in a category page with pagination, you still need to usearchiveListTag, and set it fortype="page"andlimitProperty.