Many AnQiCMS users may have a question: for the article detail page'sprevArchiveTags, can it also be flexibly applied to non-article content, such as product detail pages, to get the previous or next product?Today, let's delve deeply into this issue.
The unity of AnQiCMS content model:archivePhilosophy
To answer this question, we need to first understand the core design concept of AnQiCMS in content management.AnQiCMS is a major highlight with its flexible content model.This means that the system is not limited to the traditional 'article' concept, but allows users to customize various content types according to their business needs, such as products, news, cases, events, and so on.This highly customized capability greatly enhances the adaptability of the system, allowing AnQiCMS to meet various content publishing scenarios.
In the evolution process of AnQiCMS, it is particularly noteworthy that a significant update was made to version 2.1.1:“Redo the template tag, remove the original article/product tag, and add the new archive tag”This change is not a simple name replacement, it marks the realization of the content model unification at the template tag level of AnQiCMS.
After that, whether it is an 'article' or a 'product', it is generalized as the common concept 'archive' in the template.This means that when you create a "product modelThis uniformity lays the foundation for the generalized use of template tags, greatly simplifying the work of template developers.
prevArchiveTag: The realization of general content navigation.
Based on the consistency of "archive", we can now clearly answer this question:Yes,prevArchiveThe tag can be used for non-article content (such as products) detail pages to get the previous product.
prevArchiveandnextArchiveThese tags are designed by AnQiCMS specifically for content detail pages, their core function is to intelligently recognize and provide links and information for the previous or next 'archive' content within the current 'archive' context. Since AnQiCMS unifies all model content into 'archive', whether you are browsing the details of an 'article' or a 'product' detail page,...prevArchiveandnextArchiveTags can accurately retrieve the previous or next record under the corresponding content model based on the "archive" context of the current page.
These tags are very concise in use, no additional parameters are needed to specify the content model ID or category ID, they willautomatically identify the content model and context of the current page.For example, when you are browsing a product details page, the system knows that the current page is an 'archive' entry under a certain product model, and automatically looks for the previous or next product in all products included in the product model.
Let's take a lookprevArchiveandnextArchiveThe basic usage of tags and the fields they support:
{# 假设这是产品详情页的一个片段 #}
<div class="product-navigation">
{% prevArchive prev %}
{% if prev %}
<a href="{{ prev.Link }}" class="prev-product">
<img src="{{ prev.Thumb }}" alt="{{ prev.Title }}">
<span>上一篇:{{ prev.Title }}</span>
</a>
{% else %}
<span class="no-prev">没有上一篇产品了</span>
{% endif %}
{% endprevArchive %}
{% nextArchive next %}
{% if next %}
<a href="{{ next.Link }}" class="next-product">
<img src="{{ next.Thumb }}" alt="{{ next.Title }}">
<span>下一篇:{{ next.Title }}</span>
</a>
{% else %}
<span class="no-next">没有下一篇产品了</span>
{% endif %}
{% endnextArchive %}
</div>
In this example,prevandnextThe variables will include the following available fields, which are general and applicable to any "archive" type of content:
Id(Content ID)Title(Title, i.e., product name)Link(Detail Page Link)Keywords(Keywords)Description(Introduction)CategoryId(Category ID)Views(Views)Thumb(Thumbnail, Product Image)CreatedTime(Creation Time)UpdatedTime(Update Time)- ...and other custom fields
Whether it is the title, abstract, or name, thumbnail of an article, or product, these common fields can be used to obtain and display.This greatly simplifies the reusability of templates, no need to write different previous/next logic for different content types.
Summary
AnQiCMS through its highly flexible content model and unifiedarchivelabel system, brings great convenience to content operation.prevArchiveandnextArchiveThe tag is the embodiment of this design concept, no longer confined to traditional article content, but can intelligently apply to any custom content model (including product models) detail page, providing a smooth previous/next navigation experience.This not only improved the website's user experience and internal link structure, but also made template development and content management more efficient and intuitive.
Frequently Asked Questions (FAQ)
prevArchiveandnextArchiveWill it consider the classification of content? For example, on the mobile details page, it will only show the previous/next mobile phone, but not the notebook?Generally speaking,prevArchiveandnextArchiveThe tags will be based on the current page locationContent Model (Module)Find the previous or next content.This means that if you use these tags on a "mobile productprevArchiveandnextArchiveSupportcategoryIdParameters, which means they are mainly based onthe order under the global or current content modelto judge. If strict classification navigation within is needed, it may be necessary to combinearchiveListtags to perform