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

Calendar 👁️ 66

In the powerful feature matrix of Anqi CMS, it is crucial to provide users with a smooth site navigation experience, andprevArchiveThe 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 the user's reading and the interaction of the website.As a seasoned website operations expert, I am well aware of the importance of transforming technical details into practical strategies. Next, we will delve deeper into the discussion.prevArchivethe tags returned byprevWhat exactly are the document properties that you can directly call from the variable, and how to skillfully use them.

prevArchiveThe core function of the tag andprevThe essence of the variable

When you use AnQiCMS templates{% prevArchive prev %}...{% endprevArchive %}This structure, the system will intelligently identify the current document and fill it for youprevThis variable. ThisprevA variable, actually represents a complete document (or article, product, etc., depending on your content model) object.Therefore, it can carry very rich attributes, far more than just some simple titles or links.

We can combineprevA variable is understood to be the complete data entity of the "previous" document that meets specific sorting rules (usually the reverse order of publication time or ID). This means that any document you canarchiveDetailThe document attribute called in the tag, most of which can beprevobtained directly from the variable, giving you a high degree of freedom and flexibility when building previous/next navigation.

Next, let's go into detail and sort out these document properties that can be directly called:

1. Basic identification and display information of the document

These are the most basic and core properties that make up the document, usually used to directly display to users.

  • Id(Document ID):Each document in the system has a unique numeric identifier. When you need to refer to or further process a previous document,prev.Idit is an indispensable proof of identity.
  • Title(Document Title):This is the H1 title of the previous document, directly callprev.Titleand it can be presented on the page.
  • Link(Document link):To access the URL address of the previous document,prev.LinkYou can build a direct jump link.
  • Keywords(Document keywords):The keywords set in the previous document can be accessed throughprev.Keywordsto obtain, for SEO or content association.
  • Description(Document description):The summary of the previous document, which is usually the article abstract, callsprev.Descriptionto get it.
  • CategoryId(Document classification ID):The ID of the classification of the previous document, throughprev.CategoryIdyou can find out its classification attribute.
  • Views(Document views):Number of reads or views of the previous document,prev.ViewsCan be used to display popularity indicators.
  • CommentCount(Document comments):Total number of comments received on the previous document,prev.CommentCountReflects the interactivity of the content.

Section 2: Content Details and SEO Optimization Properties

To provide a richer content preview and support SEO strategies,prevVariables also include detailed content and SEO-related properties.

  • SeoTitle(Document SEO Title):If the previous document has a separate title set for search engines,prev.SeoTitleThe value will be returned. This is very useful for providing more accurate SEO information in navigation hints.
  • Content(Document content):This is the complete text of the previous document. When you need to display a short preview or require the full content in certain scenarios, you can directly call it.prev.ContentPlease note that for security and correct rendering of HTML content, it is usually necessary to combine|safeFilter usage, for example{{ prev.Content|safe }}If the document content is in Markdown format, you can also use|renderthe filter to convert.
  • ContentTitles(Document content title list):If the previous document content is well-structured, containing multiple H tags,prev.ContentTitlesIt will return an array containing these subheadings (and their levels, tags, etc.), which is very useful for generating a small content catalog or for quick browsing.
  • CanonicalUrl(Documentation specification link):For cases where there is duplicate content or URL standardization requirements,prev.CanonicalUrlit will return the specification link of the previous document, which helps search engines correctly identify the main version.

3. Multimedia resource properties

Images are an important part of content attractiveness,prevVariables also provide various image-related properties.

  • Logo(Document cover first image):It is usually the main thumbnail or the first featured image of the document,prev.LogoDirectly return its URL.
  • Thumb(Document cover thumbnail):Automatically generated thumbnail based on the content of the system,prev.ThumbReturn its URL, commonly used for small images in lists and navigation.
  • Images(Document cover image set):If the previous document is a set image type or contains multiple feature images,prev.ImagesIt will return an array containing all image URLs, you can iterate through this array to display a multi-image preview.

4. Timestamp attribute

Time is an important indicator of content freshness,prevThe variable provides the creation and update time of the document.

  • CreatedTime(Document addition time):Timestamp of the first creation of the document.
  • UpdatedTime(Document update time):Timestamp of the last update of the document.

It should be noted that these two properties return a 10-digit timestamp, in order to display it in a readable date format on the page, you need to combine with AnQiCMS'sstampToDatetags for formatting, for example:{{ stampToDate(prev.CreatedTime, "2006-01-02") }}.

Five, Advanced and Custom Properties

In addition to the aforementioned general properties,prevThe variable, as a document object, can also access more underlying or custom data.

  • ModuleId(Document Model ID):The ID of the content model belonging to the previous document.
  • ParentId(Parent document ID):If the previous document is a child document (for example, a sub-item in a multi-level product detail),prev.ParentIdIt will return the ID of the parent document.
  • UserId(Document user ID):The ID of the user who published the previous document.
  • Price(Price),Stock(Stock),ReadLevel(Reading Level),OriginUrl(Original Link),Flag(Recommended Attribute):These are possible properties that may exist based on the content model characteristics, such as possibly invoking in the product modelprev.Price, or judgmentprev.FlagShow the "Recommended" or "Headline" indicator.
  • Category(Complete category object): prev.CategoryIt will return a complete category object, you can further access it.prev.Category.Title/prev.Category.LinkProperties such as obtaining detailed information about the category of the previous document, not just the ID.
  • Document tags (via)tagListCall):AlthoughprevDoes not provide directly oneTagsAttribute array, but you can combinetagListto pass the tag,itemId=prev.Idto get all related tags of the previous document.
  • Other custom field parameters set for the document model:If your content model defines additional custom fields (such as "author","source"), these fields will also be included asprevThe direct property of the object exists, you can access it like a built-in property, for exampleprev.Author. If you need to iterate over all custom parameters, you can combinearchiveParamsto pass the tag,id=prev.Id.

Practical code examples

Understanding these properties, we can build a navigation area that is both aesthetically pleasing and practical. Here is a common example:

”`twig {# Use prevArchive tag to get the previous document data #} {% prevArchive prev %}

{#

Related articles

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

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 the operational efficiency and SEO performance of the website.Today, let's delve deeply into a very practical template tag in AnQiCMS (`prevArchive`), focusing on whether it can retrieve the `Keywords` field of the 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

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

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