Can the `prevArchive` tag retrieve the `Keywords` (keywords) field of the previous document?

Calendar 👁️ 65

As an experienced website operations expert, I know that a detailed understanding of each tag (Tag) function in a content management system can bring a qualitative leap in website operation efficiency and SEO performance. Today, let's delve into a very practical template tag in AnQiCMS (AnQiCMS) -prevArchiveand focus on whether it can obtain the previous document'sKeywords(keyword) field.

ExploreprevArchiveTags and document keywords: AnQiCMS fine-grained content linkage

In the template design of AnQi CMS,prevArchiveThe label mainly undertakes the function of realizing the navigation of articles before and after. When a user browses a document (Archive), this label can help website developers easily obtain relevant information about the previous document of the current document, thus providing convenient jump links at the bottom or sidebar of the page, greatly optimizing the user experience and internal content flow.It is like an invisible thread that cleverly connects the series of content on the website.

Document keywords (Keywords) play a crucial role in content operation and SEO optimization.They not only help search engines better understand the theme of the page, but are also an important bridge for users to discover content through search.In the AnQiCMS backend, when we create or edit a document, there will always be a special "document keyword" field for us to fill in, and it supports manual input or selection from a keyword library, and multiple keywords are usually separated by English commas.This fully reflects the SEO-friendly design concept of AnQiCMS.

Then, let's go back to our core question:prevArchiveCan the tag retrieve the information of the previous document?Keywords(keyword) field, what about?

The answer isAffirmative.

According to the official documentation of Anqi CMS,prevArchiveThe tag clearly supports includingKeywordsmultiple important fields. This means that when you useprevArchiveAfter obtaining the object of the previous document, you can directly access itsKeywordsproperties, just like accessing itsTitleorLink.

This feature brings rich imagination and practical value to website operation.For example, you may want to display not only the title and link of the previous article at the end of the current article, but also briefly prompt the keywords of the previous article to help users quickly judge its relevance and decide whether to jump.This is very beneficial for building a more intelligent and user-friendly content recommendation system, or enhancing the on-site SEO relevance layout.

Next, let's look at how to implement this function in the AnQiCMS template with a simple code example:

{# 在文档详情页模板中使用 #}

{% prevArchive prev %}
  {% if prev %}
    <div class="prev-article-section">
      <h3>上一篇:</h3>
      <a href="{{ prev.Link }}">{{ prev.Title }}</a>
      {% if prev.Keywords %}
        <p class="keywords">关键词:{{ prev.Keywords }}</p>
      {% endif %}
    </div>
  {% else %}
    <div class="prev-article-section">
      <p>没有更早的文档了。</p>
    </div>
  {% endif %}
{% endprevArchive %}

In the code above, we first use{% prevArchive prev %}Tag to try to get the object of the previous document and name itprev. Then, through a simple{% if prev %}determination, ensure that the previous document indeed exists. If it exists, we can then proceed to{{ prev.Link }}Get the link,{{ prev.Title }}Get the title and the most critical{{ prev.Keywords }}To get the keywords of the previous document. We have also added a{% if prev.Keywords %}The judgment, to avoid displaying an empty line when there are no keywords, is a good template design habit.

Actual application scenarios:

  1. Enhance user navigation experience:After reading a technical tutorial, the user can decide more quickly whether to review related content by seeing the key words of the previous tutorial.
  2. Content relevance提示:In a series of articles on a specific topic, displaying the keywords of the previous article can strengthen the relevance between the content, encouraging users to continue exploring.
  3. SEO internal link optimization:AlthoughprevArchive主要用于用户导航,但若能将关键词展示出来,也间接提示了内容相关性,对搜索引擎爬虫理解页面结构和主题有所助益。

In short, the Anqi CMS'sprevArchiveThe tag can get the previous documentKeywordsThe field provides content operators with a more flexible and refined content联动 strategy, which helps improve the user experience and overall value of the website.


Frequently Asked Questions (FAQ)

Q1:prevArchiveTags retrieved from comments.KeywordsField, what will be displayed if the keyword is not filled in in the previous document?A1: If the keyword is not filled in in the previous document,prevArchiveObtainedKeywordsThe field will be an empty string. In the template, you can use conditional judgments (such as{% if prev.Keywords %})to control whether to display the field, thus avoiding the appearance of empty 'Keywords:' on the page, improving the user experience.

Q2: BesidesprevArchive,nextArchiveTags can also retrieve the next document.Keywords?A2: Yes,nextArchivewith the tag andprevArchiveSimilar, it is also used to obtain the information of the next document on the document detail page. According to the AnQiCMS document specification, it also supports obtainingKeywordsfield. You can use{{ next.Keywords }}Get the keywords of the next document.

Q3: If the previous document'sKeywordsfield contains multiple keywords, how can I display them separately on the page and make them clickable tags?A3:KeywordsThe field is typically stored as a comma-separated string of multiple keywords.To display them as clickable tags, you need to combine AnQiCMS templates filters and loop tags.You can usesplitThe filter splits the keyword string into an array and then usesforLoop through this array to generate a link for each keyword. For example, you can link to the website's keyword search page or the corresponding Tag list page.

Related articles

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

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

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 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

Which document properties can be directly accessed from the `prev` variable returned by the `prevArchive` tag?

In the powerful feature matrix of AnQi CMS, providing users with a smooth site navigation experience is crucial, and the `prevArchive` tag is one of the key factors to achieve this goal.It allows us to easily obtain and display information about the "previous" document on the current document page, greatly enhancing the continuity of user reading and the interaction of the website.

2025-11-07

How to safely use the `prevArchive` tag to display images in a template and prevent empty image links?

In AnQiCMS template development, achieving smooth user experience and elegant page display is our core goal.Among them, the 'Previous/Next' navigation on the article detail page is an important factor in enhancing user browsing depth and site stickiness.By using template tags like `prevArchive` and `nextArchive`, we can easily guide users to related content.However, in this process, how to safely and beautifully display the pictures of relevant articles, and avoid annoying empty picture links, has become a detail worth in-depth discussion.

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

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