How does the `prevArchive` tag determine the "previous" document, is it based on ID, time, or sort field?

Calendar 👁️ 61

As an experienced website operations expert, I fully understand the intuitive needs of content publishers for 'previous article' and 'next article' navigation and the logic behind it. In AnQiCMS (AnQiCMS),prevArchiveTags are designed to meet such needs. However, regarding the basis for determining the 'previous' document - whether it is based on ID, time, or sorting field, this is indeed a topic worth in-depth discussion.

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 rule.This means, it will not 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, dynamic response based on context.

Where does this 'wisdom' manifest? In short,prevArchiveThe basis for the label to judge the 'previous article' document isIt depends on the current list environment (if any) and the sorting rules set by that environment.

Let's break down this process step by step:

The context takes precedence: the sorting rule of the list is dominant

When a document is accessed, if it is clicked into from a specific document list (such as, article classification list, tag article list, etc.), then this list is usually accessed through AnQiCMS.archiveListGenerate a tag. AndarchiveListTags are supported throughorderParameters to specify the sorting method. For example:

  • order="id desc": Sort by document ID in reverse order (the latest released ID is the largest, and it is ranked in front).
  • order="views desc": Sorted in descending order by view count (the most viewed items are at the top).
  • order="sort desc": Sorted in descending order by a custom sorting field on the backend (usually manually set by operations staff).

In this case,prevArchiveThe label will cleverly follow the sorting rules currently adopted by the list. If your category list is sorted by publish time (corresponding to 标签会非常聪明地遵循当前列表所采用的排序规则。如果你的分类列表是按照发布时间(对应 标签会非常聪明地遵循当前列表所采用的排序规则。如果你的分类列表是按照发布时间id descorcreatedTime desc) In reverse order, the "Previous" article would naturally be the one that is "earlier" or has a smaller "ID" in the list. Similarly, if the list is sorted by the number of views,prevArchiveWe can find a document with a higher level of page views than the current document as the 'previous article'.

It can be said,prevArchiveThe label's behavior is 'responsive', respecting the document order expected by the content operator when building the list.

2. Default behavior: When there is no explicit context.

However, not all documents are always accessed in a clear list with a specific sorting rule.Sometimes, users may directly access a document detail page through a link, or enter from the search engine results page.In the absence of explicit list context,prevArchiveHow does the tag determine 'previous article'?

At this moment, AnQiCMS will use a set of default sorting logic to determine the relative position of the document. According toarchiveListLabel documentation, if not specifiedorderparameters,“Default custom sorting”. This “custom sorting” usually refers to the document configuration in the background management interfacesortThe field. Operators can set a sorting value for each document in the background, with smaller numbers appearing earlier. IfsortThe 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 latest).

Therefore, when there is no explicit list sorting context,prevArchivetends to refer to the custom sorting field in the backgroundsortThe document ID or publication time determines which one is the previous article.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,prevArchiveThe label judgment of the "previous" document is not based on a single ID, time, or sorting field, but on a dynamic, step-by-step comprehensive consideration process:

  1. The primary basis: The document is located inSorting rules of the explicit list(ThrougharchiveListoforderParameter 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 default tothe default custom sorting (sort desc)This may follow with document ID or reverse chronological creation time.

This design makes the document navigation of AnQiCMS both flexible and intelligent. Operators can accessarchiveListThe label precisely controls the sorting of the list, thereby indirectly affectingprevArchiveandnextArchiveThe behavior; at the same time, the system also provides a reasonable default fallback mechanism to ensure the availability of navigation functions in various scenarios.


Frequently Asked Questions (FAQ)

1. Can I directly go in.prevArchiveLabel the sorting method, for example, to find the previous one only based on the publish time? Answer: prevArchiveThe tag does not accept any parameters to specify the sorting method. Its behavior is determined by the context of the current document (such as the parent list). If you wishprevArchiveNavigate by publish time, you need to make sure that the list of current documents (such as category lists) includes byarchiveListtags and setorder="id desc"(ID is usually closely related to the publication time, the larger the ID, the later the publication time) for sorting.

2. If my website does not set anyorderparameter,prevArchiveWhat determines the label for "Previous"? Answer:Without explicit settingorderIn the context of the parameter list, AnQiCMS will follow its default sorting logic. According to the document, this default logic is to sort according tocustom sorting field in the background(order="sort desc")To determine the document order. If the custom sorting field has not been set or is the default value, the system will usually further revert 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 makeprevArchiveandnextArchiveThe navigation order of the tags matches the document order I manually adjusted in the background? Answer:The most direct and recommended method to achieve this goal is to explicitly use when generating the document list.archiveListtags and setorder="sort desc"Parameters. The AnQiCMS backend usually has a "Sort" or "Display Order" field for operators to manually adjust the priority of documents. When the list is sorted in reverse order by this field,prevArchiveandnextArchiveIt will follow the manual order you set in the background.

Related articles

How to display a default 'Return to list' or 'Home' link when the previous document is not found?

As an experienced website operations expert, I know that every detail in a content management system can affect the user's visit experience and the overall performance of the website.Especially on the document detail page, users expect to be able to browse related content smoothly.When the 'previous' document is missing for various reasons (such as being deleted, archived, or being the first one), how can one elegantly provide a fallback option instead of leading the user into a dead end, which is exactly the problem that AnQiCMS's flexibility can solve.

2025-11-07

Does the `prevArchive` tag span different categories (`CategoryId`) or content models to find the previous document?

As an experienced website operations expert, I know that behind each CMS tag lies the key logic that affects user experience and SEO performance.AnQiCMS is known for its efficiency and flexibility, and its template tag system is an important tool for content operators to achieve fine-grained control.

2025-11-07

How does AnQi CMS ensure that the `prevArchive` tag can still correctly parse links in dynamic URL structures?

As an experienced website operations expert, I am well aware that in an increasingly complex network environment, how to effectively manage and present content while ensuring user experience and search engine optimization is a core challenge facing every operator.Especially for a powerful and highly flexible content management system like AnQiCMS (AnQiCMS), a deep understanding of its underlying mechanisms can greatly enhance our content operation strategies.Today, we will delve into a common but crucial scenario: how AnQi CMS ensures that like

2025-11-07

How to combine the `prevArchive` tag with the HTML `<a>` tag to create a clickable navigation for the previous document?

As a senior website operations expert, I know that a smooth and intuitive user experience is crucial for the success of a website.AnQiCMS (AnQiCMS) with its powerful template engine and rich built-in tags, enables content operators to easily create beautiful and practical website features.Today, let's delve deeply into one of the very practical tags - `prevArchive`, and see how it cleverly combines with the HTML `<a>` tag to create an engaging 'Previous document' navigation for your website.

2025-11-07

What are the potential benefits of using the `prevArchive` tag for article navigation on website SEO?

## Navigation goes beyond this: How does the `prevArchive` tag of AnQi CMS subtly enhance your website's SEO performance?In today's highly competitive online environment, every detail of a website can become a key factor affecting search engine rankings.For many operators who use AnQiCMS (AnQiCMS) to efficiently manage content, the `prevArchive` tag, which seems simple, often hides the SEO value that is often undervalued.

2025-11-07

How to add custom prefix or suffix text to the output text of the `prevArchive` tag?

As an experienced website operations expert, I am well aware of how to flexibly use the template tags in such a powerful content management system as AnQiCMS to present content, which is crucial for improving the user experience and operational efficiency of the website.Today, let's delve into a seemingly simple yet highly practical question: **How to add custom prefix or suffix text to the output text of the `prevArchive` tag??

2025-11-07

Does the `prevArchive` tag get the comment count (`CommentCount`) of the previous document data?

As an experienced website operations expert, I know that how to efficiently call and display data in a content management system is the key to improving user experience and operational efficiency.When using AnQiCMS for content creation and site maintenance, friends often ask such detailed questions: Does the `prevArchive` tag include the number of comments (`CommentCount`) in the data of the previous document obtained?### AanQi CMS `prevArchive` tag and comment count

2025-11-07

If the previous document has not set a thumbnail or Logo, what placeholder will the `prevArchive` tag display?

As an experienced website operations expert, I know that every detail can affect user experience and the professionalism of content presentation.In a powerful content management system like AnQiCMS, how to elegantly handle content display, especially visual elements like images, is something operators need to pay special attention to.Today"---## Reveal"

2025-11-07