As an experienced website operation expert, I often deal with AnQiCMS (AnQiCMS) in my daily work, and I am well aware of its powerful and flexible template tags. Today, let's delve into a crucial tag in content navigation -prevArchiveIt can help us easily implement a seamless jump to the "previous document" and it can provide some basic information about the previous document, making our website content operation more skillful.
Unlock the previous exciting article: In-depth analysis of AnQi CMSprevArchiveWhat kind of document information can tags obtain
In AnQi CMS,prevArchiveTags are a good helper for content detail pages, their core function is to help users smoothly jump to earlier documents in terms of time or sorting after reading the current document, thereby providing a coherent reading experience.This not only optimizes the user's stay time on the website, but also indirectly enhances the internal link structure of the website, which has a positive effect on SEO.
UseprevArchiveTags are very intuitive, and their basic form is{% prevArchive prev %}...{% endprevArchive %}. Here, we usually define a variable (such as the example in theprev), to carry all the available information automatically recognized by the system for the previous document. It is worth noting that,prevArchiveWhen calling the tagNo additional parameters are requiredTo specify which document is the previous one, the system will automatically locate it intelligently based on the context of the current page.
Then, when we go throughprevArchiveHow can you get practical basic information from the previous document after successfully obtaining theprevvariable? Next, I will reveal it to you one by one.
1. Basic Identity and Navigation Information: The 'business card' of the document
When we talk about a document, the first thing that comes to mind is its identity and how to access it.prevArchiveThis label provides comprehensive basic information:
- Document ID (
Id)This is the unique identifier for each document in the AnQi CMS system, although it is usually not displayed directly on the front end, but it is the basis for internal logic and data association. - Document title (
Title)This is the most direct and important information, usually used to display in navigation links, allowing users to understand the theme of the previous document at a glance, for example, 'Previous: Use of AnQi CMS template tags.' - Document link (
Link):There is no doubt that this is the 'life line' for achieving the jump. Obtaining toLinkAfter the field, we can build a clickable hyperlink to guide the user to the previous document. - Document keywords (
Keywords) and document description (Description): Although this metadata is not often displayed directly in navigation, it can be used astitleproperty oraltThe supplement of properties provides richer context information for links, which is very helpful for improving SEO friendliness and providing more hints when hovering over with the mouse.
A typical text link navigation example is like this:
{% prevArchive prev %}
{% if prev %}
<a href="{{ prev.Link }}" title="{{ prev.Description }}">{{ prev.Title }}</a>
{% else %}
<span>没有更早的文档了</span>
{% endif %}
{% endprevArchive %}
2. Content attributes and interaction metrics: Understand the 'popularity' of the document
In addition to the basic identity,prevArchiveCan provide insights into the properties of the document content and user interaction:
- Document classification ID (
CategoryId)This ID points to the category of the previous document. Through it, we can further utilizecategoryDetailTags, obtain the name, link, and other detailed information of the category, so as to achieve more accurate "previous article in the same category" navigation, and enhance the logic of content organization. - Document view count (
Views)The number of times the previous document was accessed is displayed, which can directly reflect the popularity of the document.In some designs, operators may choose to attach the number of views next to the 'Previous Article' navigation to attract user clicks. - Number of document comments (
CommentCount)This field shows the total number of comments under the previous document. It is also an indicator of the interaction heat of the document. If the comments are active, it can encourage users to participate in community discussions.
3. Visual Elements: Bring Navigation to Life
Navigation that is purely textual can sometimes seem monotonous, but visual elements can greatly enhance click-through rates and user experience:
- Document cover first image (
Logo) and document cover thumbnail (Thumb):LogoIt usually refers to the original large image or main image of the article, andThumbIt is a thumbnail automatically generated and optimized by the system. We strongly recommend using it when building the navigation of the previous document.ThumbA field that can provide a lightweight visual preview, without affecting page loading speed, and make navigation more vivid and interesting.
A navigation example with thumbnails is like this:
{% prevArchive prev %}
{% if prev %}
<a href="{{ prev.Link }}" class="prev-article-link">
{% if prev.Thumb %}
<img src="{{ prev.Thumb }}" alt="{{ prev.Title }}" class="prev-thumb">
{% endif %}
<span class="prev-title">{{ prev.Title }}</span>
</a>
{% else %}
<span class="no-prev-article">没有更早的文档了</span>
{% endif %}
{% endprevArchive %}
4. Time information: Master the 'age' of the document
The time of document publication and update, which is an important basis for evaluating the timeliness of certain types of content (such as news, technical articles):
- Document added time (
CreatedTimeAnd document update time (UpdatedTime)These two fields are provided in the form of timestamps. In order to display them friendlier on the front-end page, we need to use the provided by AnQi CMSstampToDateThe filter performs formatting. For example,{{ stampToDate(prev.CreatedTime, "2006-01-02") }}The timestamp can be converted to the format “year-month-date”, which is convenient for users to understand the publication or latest update date of the content.
Integrate the above informationprevArchiveTags can give you great flexibility and expressiveness when building website navigation.It is not just a simple link, but also an effective bridge connecting users with content and enhancing the overall website experience.
Frequently Asked Questions (FAQ)
Q1: If the current document is the first one in this category,prevArchivewhat will the tag display?
A1:If the current document is already the oldest one in its category or within the global range, meaning there is no previous document to retrieve, then{% prevArchive prev %}in the labelprevthe variable will be null (ornil)。Therefore, always use it in the template{% if prev %}Such conditional judgment to check if a variable exists is a very robust and recommended practice to avoid blank or error messages when there is no previous document.
Q2:prevArchiveandnextArchiveHow are the ways of using tags different? Do they provide the same information?
A2: prevArchiveUsed to get the 'previous' document, andnextArchiveIt is used to get the 'next document'. They are functionally complementary and usually appear in pairs at the bottom of the document details page, providing the full article