Can the `prevArchive` tag retrieve the `Description` (summary) field of the previous document?

Calendar 👁️ 61

Good, as an experienced website operation expert, I am willing to delve deeply into the Anqi CMS for youprevArchiveThe use of tags and answer questions about retrieving the document summary (Description) field.


Unlock AnQi CMSprevArchiveTag: Easily get the summary of the previous document.

In the daily operation of websites, we often need to provide users with a smooth reading experience, guiding them to discover more related content.This is where the 'Previous' and 'Next' navigation in the article detail page plays a crucial role.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that naturally provides us with powerful template tags to easily achieve this function.Today, let's delve intoprevArchiveTag, and pay close attention to whether it can obtain the previous document'sDescription(Abstract) field.

prevArchiveTag: A powerful assistant for content navigation

prevArchiveThe tag in the Anqi CMS template system, as the name implies, is used to obtain information about the "previous" document of the current document.It is usually applied to the document detail page, helping users seamlessly switch to the previous article in the sequence.

In the template design of AnQi CMS,prevArchiveThe use of the tag is very intuitive, its basic form is:

{% prevArchive prev %}
    {# 在这里使用 prev 变量来访问上一篇文档的数据 #}
{% endprevArchive %}

Here, prevIs a custom variable name we use, it will carry all the available data from the previous document. If the current document is already the first in its category, thenprevThe variable will be empty, which requires us to make a judgment in the template to avoid displaying unnecessary links.

Core answer:prevArchiveCan be obtainedDescriptiondo you?

The answer is:Absolutely!

According to the official documentation of Anqi CMS,prevArchiveThe label carriesprevVariables that can access many core fields of the previous document, including the ones we are concerned aboutDescription(Summary) field. This means that you can not only display the title and link of the previous document, but also add a brief summary to it, greatly enhancing the attractiveness and information volume of navigation.

ObtainDescriptionThe method of the field is very simple, just byprev.Descriptionand it is done:

{% prevArchive prev %}
    {% if prev %}
        <div class="previous-article-summary">
            <h3>上一篇:<a href="{{ prev.Link }}">{{ prev.Title }}</a></h3>
            <p>{{ prev.Description }}</p> {# 这里就是获取上一篇文档的摘要 #}
        </div>
    {% else %}
        <p>这是当前分类下的第一篇文档,没有更早的内容了。</p>
    {% endif %}
{% endprevArchive %}

In this way, when users browse to the end of the document, they can not only see the title of "Previous", but also catch a glimpse of the content outline, which has a significant positive effect on stimulating user click interest and improving the discovery rate of website content.

Enhance user experience: Create rich media navigation by combining more fields

It may not be enough to just display the title and summary.prevArchiveLabels also support getting many useful fields, you can combine them cleverly to provide users with a richer and more intuitive navigation experience. BesidesTitleandDescriptionYou can also access the following fields:

  • Id: The unique ID of the document.
  • Link: The access link of the document.
  • Keywords: The keywords of the document.
  • CategoryId: The ID of the category to which the document belongs.
  • Views: Document views.
  • Logo: Document cover first image address.
  • Thumb: Document cover thumbnail address.
  • CreatedTime: Document creation time (timestamp, need to be formatted).
  • UpdatedTime: Document update time (timestamp, formatted).

For example, on your blog or news website, you can create a "Previous" navigation block that includes thumbnails, titles, summaries, and publish times:

{% prevArchive prev %}
    {% if prev %}
        <div class="prev-article-card">
            <div class="prev-article-thumb">
                {% if prev.Thumb %}
                    <a href="{{ prev.Link }}">
                        <img src="{{ prev.Thumb }}" alt="{{ prev.Title }}">
                    </a>
                {% endif %}
            </div>
            <div class="prev-article-content">
                <p class="prev-article-meta">发布于:{{ stampToDate(prev.CreatedTime, "2006年01月02日") }}</p>
                <h4 class="prev-article-title">
                    <a href="{{ prev.Link }}">{{ prev.Title }}</a>
                </h4>
                <p class="prev-article-description">{{ prev.Description|truncatechars:100 }}</p> {# 摘要截断显示,避免过长 #}
            </div>
        </div>
    {% else %}
        <p class="no-prev-article">您正在阅读第一篇文档。</p>
    {% endif %}
{% endprevArchive %}

In the above code, we usedprev.Thumbto display thumbnails,stampToDatea filter to format the time, and utilizetruncatecharsa filter to ensure the summary is not too long, thus maintaining the neat layout of the page.

Conclusion

Of Security CMSprevArchiveTags can easily implement the navigation function of the "Previous" document and, more importantly, they provide rich data interfaces, allowing website operators to deeply explore the value of content, and enhance user experience and the attractiveness of website content through multi-dimensional information such as abstracts and thumbnails.Use these tags flexibly, and your website will significantly improve user retention and in-depth content reading.


Frequently Asked Questions (FAQ)

Q1:prevArchiveandnextArchiveThe tag can be used on which pages and does it require special configuration?A1:prevArchiveandnextArchiveThe tag is mainly designed forDocument detail page. On these pages, the system can automatically identify the current document and find the logical previous or next one.In most cases, they do not require any additional special configuration, as long as the current page is a document detail page and there is a logical 'previous' or 'next' document, the tag can work normally and return data.If the document detail page is not througharchiveDetailThe label rendering or the page URL structure not meeting expectations may cause the label to be unable to correctly obtain the context document.

Q2: If the previous document has not been filled outDescription.{{ prev.Description }}what will be displayed?A2: If the previous document'sDescriptionfield is not filled in the background, then{{ prev.Description }}An empty string will be displayed on the front end, meaning nothing will be output. This usually does not cause the page to error, but for better user experience, you can combine conditional judgment to handle it, for example:

{% if prev.Description %}
    <p>{{ prev.Description }}</p>
{% else %}
    {# 可以在这里显示一段默认文本,或者不显示摘要区域 #}
    <p>点击查看上一篇精彩内容!</p>
{% endif %}

Q3: Besides obtainingTitleandDescription,prevArchiveWhat other fields can be obtained to enrich the display effect of the previous document?A3: BesidesTitleandDescription,prevArchiveThe label also provides many useful fields, such as:

  • Link: Link to the previous document.
  • Thumb: Thumbnail address of the previous document, which can be used to display a visual preview.
  • CreatedTime: The release time of the previous document can be accessed bystampToDateThe filter formats the display and provides time cues.
  • ViewsThe number of views of the previous document, which can be used as an indicator of the popularity of the content. Make good use of these fields, you can design a navigation block for the 'Previous article' that is more attractive and conforms to users' browsing habits.

Related articles

The document for the previous archive tag is determined by what logic or sorting rules?

## Unveiling the Anqi CMS `prevArchive` tag: The intelligent sorting logic of the "Previous" document As an experienced website operations expert, I know that behind each CMS tag lies the potential to enhance user experience and SEO efficiency.AnQiCMS (AnQiCMS) is known for its efficiency and flexibility, and its template tag system is an extremely powerful tool for content operations.Today, let's delve into a seemingly simple but actually cleverly logical tag: `prevArchive`, and how it intelligently determines what we mean by 'previous document'

2025-11-07

How to add custom CSS styles or HTML attributes to the link generated by the `prevArchive` tag?

As an experienced website operations expert, I am well aware of the importance of meticulous template customization in content management systems for enhancing user experience and the overall style of the website.AnQiCMS (AnQiCMS) provides us with great flexibility with its efficient architecture based on the Go language and a Django-like template engine.Today, let's delve into a common customization requirement: how to add custom CSS styles or HTML attributes to the link generated by the `prevArchive` tag for the 'previous article'.

2025-11-07

`prevArchive` label outside the article detail page (such as the list page) whether it can still effectively obtain the previous document?

## Deep Dive into the `prevArchive` tag of Anqi CMS: The Mystery of the 'Previous' on List Pages As an experienced website operations expert, I am well aware that in daily content management, every tag and every function contains the potential to improve user experience and operational efficiency.AnQiCMS, with its simple and efficient features and SEO-friendly characteristics, has become a powerful assistant for many small and medium-sized enterprises and self-media operators.

2025-11-07

Can you get the views (Views) information of the previous document through the `prevArchive` tag?

## Deep Dive into AnQi CMS: Can the `prevArchive` tag retrieve the page views of the previous document?As an expert in website operations for many years, I know that every CMS system is crucial in terms of content management and data presentation.AnQiCMS (AnQiCMS) boasts its high efficiency and flexibility, and has been favored by many small and medium-sized enterprises and content operators.

2025-11-07

How to format the `CreatedTime` or `UpdatedTime` obtained from the `prevArchive` tag into a readable date and time?

In website operation, the time of content release or update is an important part of conveying information to users.A clear and readable date-time format, which can not only improve the user experience but also enhance the professionalism and timeliness of the content.However, many content management systems typically use a string of timestamps that are difficult to understand intuitively.

2025-11-07

Does the `prevArchive` tag support getting custom field content from the backend of the previous document?

As an experienced website operation expert, I have a deep understanding of AnQiCMS (AnQiCMS) template tags and content operation strategies, and I am glad to give you a detailed explanation of the function of the `prevArchive` tag and discuss how to cleverly obtain the custom field content of the previous document. --- ### In-depth Analysis of AnQiCMS `prevArchive` Tag and Custom Field Retrieval Strategy In AnQiCMS template development, `prevArchive` and `nextArchive`

2025-11-07

How to avoid the `prevArchive` tag from outputting an empty value or causing a template error when there is no previous document?

As an experienced website operations expert, I know that the robustness of templates in content management systems is crucial for the stable operation of the website and the user experience.AnQiCMS with its efficient and flexible template system has won the favor of many users, but even an excellent system needs to master some skills in practical application to fully exert its power.Today, let's delve deeply into a common but often overlooked issue in AnQiCMS template development: how to avoid the `prevArchive` tag from outputting an empty value or causing the template to error when there is no previous document

2025-11-07

How to effectively use the `prevArchive` tag to enhance the internal link structure and user navigation experience of a website?

## Unlock AnQi CMS `prevArchive` tag: A comprehensive guide to effectively optimizing internal links and user navigation experience In today's increasingly user experience and search engine optimization-focused era, the internal link structure and navigation fluidity of a website are particularly important.As an experienced website operations expert, I am well aware of the powerful potential of AnQiCMS (AnQiCMS) in content management and SEO.

2025-11-07