How to flexibly display article and product lists in a content management system is the key to improving user experience and optimizing information architecture.AnQiCMS (AnQiCMS) has provided us with a variety of practical sorting methods in this aspect, allowing us to accurately present information based on different business needs and content strategies.
Core sorting mechanism: Flexible control of content order
The Anqi CMS enables fine-grained control over the order of article and product listings through its powerful template tag system. The most direct way to sort is manifested inarchiveListandtagDataListContent list label'sorderIn the parameters.
Custom sorting in backendThis is the most basic and most flexible sorting method. In the content management backend, you can manually adjust the display order of articles or products in the list according to your actual operational needs.When you use in the template
order="sort desc"When, the list will be strictly arranged in the custom order set in the background.This means you can manually push important content that needs to be displayed first, without changing other attributes such as the publish time or view count, which is especially convenient when making thematic recommendations or new product launches.Sorted by publish ID (newest/oldest)For content that needs to emphasize timeliness, such as news updates, blog articles, or new product releases, sorting by release ID is**a choice.
- Use
order="id desc"The content is arranged in descending order by publication ID, which usually means that the latest content will be displayed at the top of the list. This allows users to get the latest information first. - Use
order="id asc"Content is arranged in ascending order by publication ID, with the earliest published content at the top of the list, suitable for displaying the development history of content or tracing back by creation time.
- Use
Sort by view count (popular/unpopular)Would you like to display the most popular or highly regarded content on the website? Anqi CMS supports sorting by the view count of content.
- Use
order="views desc"The list will be sorted by view count from high to low, presenting the most popular articles or products to users.This helps to increase the exposure of popular content, guiding users to discover the精华 content of the website. - Theoretically, it can also be done.
views ascTo showcase less popular content, but it is rarely used in operation.
- Use
An auxiliary strategy that affects the order of content display.
In addition to the direct sorting parameters, Anqi CMS also provides a variety of functions, which, although not direct sorting commands, can effectively affect the final presentation order and priority of content on the page.
Recommended Attribute (Flag) FilterThe articles and products of Anqi CMS support setting various 'recommended attributes', such as 'Headline[h]', 'Recommended[c]', 'Slider[f]', and so on.These properties can be used as powerful filtering criteria. For example, you can first filter out all articles with the 'recommended[c]' attribute, and then apply the above publishing ID or view count sorting in this subset.This combination of 'first filter then sort' can allow you to accurately display key operational content on the homepage or in specific areas, such as 'This week's editor's picks' or 'Homepage carousel products'.
Timed publishing functionThe AnQi CMS supports setting future publish times for articles and products.Although the content will not appear in the front-end list before it is published, but once it reaches the set time, it will naturally integrate into the list according to its publishing ID (usually in chronological order).This is an excellent automation tool for the content editing team, ensuring that content goes live on schedule without human intervention.
Custom Field and Template Logic of Content ModelOur AnQi CMS allows us to define rich custom fields for articles and products, such as "product rating", "product price", etc. Although
archiveListThe label does not directly support sorting based on these custom fields, but we can use these fields to implement more complex display logic in the template.For example, after obtaining a list of contents in a template, you can write additional template logic (such as using conditional judgment or Go language sorting functions) to sort or highlight based on custom fields, thereby achieving requirements such as "price from low to high", "highest rating", and so on.Display order of categoriesAlthough this mainly controls the arrangement of the category itself, the display order of the category indirectly affects the user's browsing path of the content.In the background, you can adjust the order of categories, the smaller the number, the earlier it appears.If your content list is displayed by category, then the order of the categories will naturally affect the overall presentation order of the下属 articles or products.
In summary, Anqi CMS not only provides basic and practical content sorting options, but also offers a rich toolbox for content operators and website developers through its flexible content model and template system, to meet various complex content display needs.By skillfully applying these sorting methods and auxiliary strategies, we can make the content organization of the website more efficient and the user experience more smooth.
Frequently Asked Questions (FAQ)
1. How can I set the default sorting method for articles or products in the background?The default sorting of Anqi CMS usually follows the "custom sorting" rule.This means you can go to the content management backend, enter the article list or product list, and manually adjust the order of content through drag and drop or other editing tools. In addition,archiveListin the labelorder="sort desc"The parameter is used to call the custom sorting set in the background.
2. Does AnQi CMS support multi-condition combination sorting, such as sorting by category first, then by publication time?directly inarchiveListortagDataListlabel'sorderSet multi-condition combination sorting in the parameters (such asorder="category desc, id desc"It is not directly supported. The usual implementation is:
- Step by step retrieval and display:You can first go through:
categoryListUse tags to get all categories, then iterate through each category, and within each category, use tags to get the information.archiveListTags are retrieved under the category based on the release time or other conditions. - Logic processing inside the template:If you need to implement multi-condition sorting in a unified list, you may need to obtain a larger content collection in the template, and then implement it through more advanced template logic (such as writing custom filters or through secondary development before the data is passed into the template).
3. Can I sort articles or products based on a custom field (such as 'Product Price' or 'Expert Rating') with Anqi CMS?
archiveListlabel'sorderThe parameter does not directly support specifying custom fields for sorting. But you can:
- By filtering and highlighting:Use custom fields to filter content, for example, to only display products with "high ratings". Then, apply ID or view count sorting within this filtered subset.
- Template-level secondary processing:In the template, you can obtain a list of articles or products containing custom fields, and then by writing template logic (such as using
forloop andifConditions) to simulate sorting or highlighting specific content. For more stringent sorting requirements, it may be necessary to extend the template engine of Anqi CMS or implement sorting by custom fields through secondary development on the server.