As an experienced website operations expert, I fully understand the intuitive needs of content publishers for the 'Previous article' and 'Next article' navigation, as well as the logic behind it. In AnQiCMS (AnQiCMS),prevArchiveLabels are designed to meet this need.However, regarding the basis for judging the “previous” document - whether it is based on ID, time, or sorting field, this is indeed a question worth delving into.

To understandprevArchiveThe operation mechanism of the label, we first need to clarify a core fact:prevArchiveThe label itself does not accept any parameters to specify the sorting rules.This means, it won't directly let you tell it 'Please find the previous one according to the ID' or 'Please find the previous one according to the publication time'.Its judgment is more of a 'wisdom' based, context-driven dynamic response.

Where does this 'wisdom' manifest itself? In short,prevArchiveThe basis for judging the 'previous' document of the label isDepends on the current list environment (if any) and the sorting rules set by that environment.

Let's break down this process step by step:

一、Context precedence: List sorting rules are dominant

When a document is accessed, if it is clicked into from a specific document list (such as, article category list, tagged article list, etc.), then this list is usually accessed through AnQiCMS.archiveListLabels can be used to generate.archiveListLabels support sorting through parameters.orderFor example, you can specify the sorting method using parameters.

  • order="id desc"The documents are sorted in reverse order by document ID (the latest released ID is the largest and is placed at the front).
  • order="views desc":According to the number of views in descending order (the highest number of views is in front).
  • order="sort desc":According to the custom sorting field on the back-end in descending order (usually manually set by the operation personnel).

In this case,prevArchiveTags will be very cleverly follow the sorting rules adopted by the current list. If your classification list is sorted by the date of release correspondingid descorcreatedTime desc)In reverse order, then the "Previous Article" naturally refers to the document that is "earlier" or has a smaller "ID" than the current document in the list. Similarly, if the list is sorted by the number of views,prevArchiveWould find documents with higher page views than the current document by one level as the "previous document".

It can be said that,prevArchiveThe behavior of the label is 'responsive', respecting the document order that the content operator expects when building the list.

Part two: Default behavior: When there is no clear context

However, not all documents are always accessed in a clear, ordered list with specific sorting rules.Sometimes, users may directly access a document detail page through a link or enter from the search engine results page.prevArchiveHow does the label judge the 'Previous'?

At this moment, AnQiCMS will use a set of default sorting logic to determine the relative position of the document. According toarchiveListLabel documentation, when not specifiedorderwhen“Sorted by custom order by default”. This “custom sorting” usually refers to the sorting configuration of documents in the background management interfacesortField. Operators can set a sorting value for each document in the background, with smaller numbers appearing earlier.sortThe field is not set, the system may further revert to the default logic based on document ID or creation time (usually in reverse ID order, i.e., the most recent).

Therefore, when there is no explicit list sorting context,prevArchivetending to refer to the custom sorting field in the backgroundsortThe previous one is determined by document ID or publication time.This ensures that even in the most extensive access scenarios, the relative navigation between documents remains logical and predictable.

3. Comprehensive consideration of ID, time, and sorting field

In summary,prevArchiveLabel judgment of "Previous" document is not based on a single ID, time, or sorting field, but rather a dynamic, step-by-step comprehensive consideration process:

  1. Primary basisEnglish current document locationExplicit list sorting rules(specified byarchiveListoforderParameter specified, such asid desc/views desc/sort desc).
  2. Secondary basis (default fallback)If the document does not have an explicit list context, or the list does not specify a sorting rule, the system will revert tothe default custom sorting (sort desc)English translation: , followed by document ID or creation time in reverse order.

This design makes the document navigation of AnQiCMS both flexible and intelligent. Operators canarchiveListLabel precise control of the list sorting, thereby indirectly affectprevArchiveandnextArchiveThe behavior; at the same time, the system also provides a reasonable default fallback mechanism to ensure the availability of navigation functionality in various scenarios.


Common Questions and Answers (FAQ)

1. Can I directly inprevArchiveLabel the sorting method specified, such as only finding the previous one based on the publish time? Answer: prevArchiveThe label itself does not accept any parameters to specify the sorting method. Its behavior is determined by the sorting of the current document context (such as the parent list). If you wishprevArchiveNavigate by publication date, you need to ensure that the list containing the current document (such as the category list) is includedarchiveListLabel and setorder="id desc"The sorting is performed based on the value of (ID is usually closely related to the release time, the larger the ID, the later the release time).

2. If my website has not set anyorderparameters,prevArchiveWhat determines the "Previous Article" based on the label? Answer:Without explicit settingorderParameters list context, AnQiCMS will follow its default sorting logic. According to the document, this default logic is sorted according toCustom sorting field in the backgroundorder="sort desc")To determine the document order.If the custom sort field is not set or is the default value, the system will usually further fallback to the logic based on document ID (in reverse order) or creation time (in reverse order), that is, the most recently published documents are listed first.

3. How to makeprevArchiveandnextArchiveDoes the navigation order of the tags match the document order I manually adjusted in the background? Answer:The most direct and recommended method to achieve this goal is to explicitly use it when generating the document listarchiveListLabel and setorder="sort desc"参数。AnQiCMS后台通常会有一个“排序”或“显示顺序”字段供运营者手动调整文档的优先级。当列表以此字段倒序排列时,prevArchiveandnextArchiveIt will navigate accordingly based on the manual order you set in the background.