How to flexibly display articles and product lists in a content management system is the key to enhancing user experience and optimizing information architecture.The AnQiCMS provides us with various practical sorting methods in this aspect, allowing us to accurately present information according to different business needs and content strategies.

Core sorting mechanism: Flexible control of content order

The strong template tag system of Anqi CMS gives us fine-grained control over the order of article and product list display. The most direct sorting method is evident inarchiveListandtagDataListTags for content listorderin the parameters.

  1. Custom sorting on 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.order="sort desc"When, the list will be arranged strictly according to the custom order you set in the background.This means you can manually top important content that needs to be prioritized, without changing the publish time or other attributes such as views, which is especially convenient when making thematic recommendations or launching new products.

  2. Sorting by published ID (newest/oldest)For content that needs to emphasize timeliness, such as news updates, blog articles, or new product releases, sorting by publish ID is the **choice.

    • Useorder="id desc"Content is sorted by publication ID in descending order, which usually means that the most recently published content will be displayed at the top of the list. This allows users to obtain the latest information first.
    • Useorder="id asc"The content will be sorted by release ID from small to large, with the earliest released content placed at the top of the list. This is suitable for displaying the development history of content or tracing back by creation time.
  3. Sort by view count (popular/unpopular)Do you want to display the most popular or most highly regarded content on the website? Anqi CMS supports sorting content by viewing volume.

    • Useorder="views desc":The list will be sorted by views from high to low, presenting the most popular articles or products to the users.This helps to enhance the visibility of popular content, guiding users to discover the essence of the website.
    • Theoretically, it can also be doneviews ascTo display less popular content, but it is rarely used in operation.

An auxiliary strategy that affects the order of content display.

In addition to direct sorting parameters, Anqi CMS also provides a variety of functions. Although not direct sorting commands, they can effectively affect the final presentation order and priority of content on the page.

  1. Recommended Attribute (Flag) FilteringThe articles and products of Anqi CMS support setting multiple "recommended attributes", such as "头条[h]", "推荐[c]", "幻灯[f]", and so on.These properties can be powerful filtering conditions.For example, you can first filter out all articles with theThis 'filter first then sort' combination allows you to accurately display key operational content on the homepage or specific areas, such as 'Editor's Picks of the Week' or 'Carousel Products on the Homepage'.

  2. Timing release functionThe Auto 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, once it reaches the set time, it will naturally integrate into the list according to its publication ID (usually in chronological order).This is an excellent automation tool for the content editing team, ensuring that content is published on schedule without any manual intervention.

  3. Content Model Custom Fields and Template LogicThe auto CMS allows us to define rich custom fields for articles and products, such as "product rating", "product price", and so on. AlthougharchiveListThe label itself does not directly support sorting based on these custom fields, but we can use these fields in the template to achieve more complex display logic.For example, after obtaining a content list in the template, you can use additional template logic (such as conditional judgment or Go language sorting functions) to perform secondary sorting or highlighting based on custom fields, thus achieving needs similar to 'Price from low to high', 'Highest rating', etc.

  4. category display orderAlthough this mainly controls the arrangement of the category itself, the display order of the category indirectly affects the path the user browses the content.In the background, you can adjust the order of categories, with smaller numbers appearing earlier.If your content list is displayed in categories, the order of the categories will naturally affect the overall presentation order of the articles or products under them.

In summary, AnQi CMS not only provides basic and practical content sorting options, but also offers a rich toolkit for content operators and website developers through its flexible content model and template system, to meet various complex content display needs.By proficiently applying these sorting methods and auxiliary strategies, we can make the organization of website content more efficient and the user experience more smooth.


Common 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 manually adjust the order of content by dragging or using other editing tools in the content management backend, entering the article list or product list.archiveListthe tag inorder="sort desc"The parameter is used to call the custom sorting set in the background.

2. Does Safe CMS support multi-condition combination sorting, such as sorting by category first, then by publication time?Directly atarchiveListortagDataListTagsorderParameters set multi-condition combination sorting (such asorder="category desc, id desc")is not directly supported. The usual implementation method is:

  • Step by step acquisition and display:You can first go through:categoryListto get all categories, and then traverse each category, and usearchiveListLabel the articles under the category by publication time or other conditions.
  • Logic processing within the template:If you need to implement multi-condition sorting in a unified list, you may need to retrieve a larger content collection in the template, and then achieve more advanced template logic (such as writing custom filters or through secondary development before data is passed to the template) to implement it.

3. If I want to sort articles or products based on a custom field (such as "Product Price" or "Expert Rating"), can the Anqi CMS do that? archiveListTagsorderThe parameter currently does not directly support specifying custom fields for sorting. But you can:

  • By filtering and highlighting:Use custom fields to filter content, such as only displaying products with "high ratings". Then apply sorting by ID or views on this filtered subset.
  • Template-level secondary processing:In the template, you can obtain a list of articles or products with custom fields, and then through writing template logic (such as usingforloop andifUsing a(condition)to simulate sorting or highlighting specific content.For more strict sorting requirements, it may be necessary to extend the template engine of the security CMS or implement custom field sorting functionality through secondary development on the server.