How to retrieve related content of the current document using the `archiveList` tag's `type="related"` mode?
As an experienced website operation expert, I am more than willing to deeply analyze AnQiCMS in detailarchiveListlabel'stype="related"Pattern, it plays a crucial role in content operation, effectively enhancing user experience and the website's SEO performance.
In-depth analysis of AnQiCMS'sarchiveListLabel: How to intelligently obtain relevant content and enhance user experience
In AnQiCMS such an efficient and customizable content management system, the effective organization and recommendation of content are the key to the success of website operation.We not only need to publish high-quality content, but also understand how to intelligently link these contents together to guide users to in-depth reading.archiveListLabel, as a core component of the AnQiCMS template system, is one of the powerful tools to achieve this goal, and itstype="related"The pattern is specifically designed for the "related content recommendation" scenario.
When a user is immersed in an article or a product detail page, they often expect to find more information related to their current interest point.At this point, precise content recommendation becomes particularly important.It can not only extend the user's stay time on the website, reduce the bounce rate, but also optimize the website's search engine ranking through the construction of internal links.AnQiCMS'archiveListTags, intype="related"In this mode, it can intelligently pick out highly relevant content from a massive amount of content, without complex logical judgments, greatly simplifying the difficulty of template development and content operation.
Core Mechanism: How is relevant content defined?
archiveListThe tag is intype="related"Under the mode, the definition of 'relevance' is not a single dimension, but provides three flexible and powerful matching logic to meet the needs of different content strategies.This means you can choose the most suitable association method based on content characteristics and operational objectives.
Automatic Smart Matching: Documents close to the same categoryThis is
type="related"The default behavior of the pattern, which is also the most convenient and efficient way.When you call this tag on the document detail page, AnQiCMS will intelligently find and recommend 'documents nearby' in the same category as the current document.Here, 'proximity' usually refers to the closeness in terms of publishing time, ID, and the like, aiming to present articles that are thematically similar and have a relatively close publishing time.Operational Value:This method does not require additional configuration and allows users to smoothly browse similar topics.For example, an article about the "AnQiCMS deployment tutorial" may automatically appear with related content such as "AnQiCMS template creation guide" or "AnQiCMS latest version update", forming a natural reading flow, which is very suitable for knowledge sharing, blog and other content operation scenarios.Keyword-driven: Precise association based on the first keywordIf you want the content recommendations to be more strategic, you can use the keywords of the document. By adding
like="keywords"the parameters to the tags, AnQiCMS will base its recommendations on the current document'sfirst keywordgo to match other documents that also contain this keyword.Operational Value:This pattern gives content operators greater control. For example, if the first keyword of a document is "SEO optimization", then even if it belongs to the "Technical Sharing" category, it can also be associated with the "Marketing" category under which there are documents containing the same keyword "SEO optimization".This helps to break down the barriers of classification, achieve cross-classification content interconnection, especially suitable for websites with clear keyword strategies.Manually precise association: exclusive recommendation designated by the operatorFor those who need highly accurate or edited recommendations,
like="relation"The parameter is your ideal choice. In this mode, AnQiCMS will only display in the background document editing interface, by the operatormanually set and associatedrelevant documents.Operational Value:This approach provides ultimate precision. You can manually select the most relevant content for users based on content quality, promotion needs, or special events.This is an indispensable tool for special topic planning, hot recommendations, or content marketing activities that require strong guidance.
How to use in practice?
Used in AnQiCMS template filesarchiveListlabel'stype="related"The pattern is very intuitive. You just need to place it in the corresponding position on the document detail page, and combineforwith loops to iterate and display the relevant content.
An example of a typical related content call is as follows:
{# related 相关文档列表展示 #}
<div class="related-articles-section">
<h3>猜你喜欢</h3>
<ul class="related-articles-list">
{% archiveList archives with type="related" limit="5" %}
{% for item in archives %}
<li class="related-article-item">
<a href="{{item.Link}}" title="{{item.Title}}">
{% if item.Thumb %}
<img src="{{item.Thumb}}" alt="{{item.Title}}" class="related-article-thumb">
{% endif %}
<h5 class="related-article-title">{{item.Title}}</h5>
</a>
<p class="related-article-desc">{{item.Description|truncatechars:80}}</p>
<div class="related-article-meta">
<span>{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
<span>阅读量:{{item.Views}}</span>
</div>
</li>
{% empty %}
<li class="no-related-content">
目前暂无相关内容推荐,敬请期待!
</li>
{% endfor %}
{% endarchiveList %}
</ul>
</div>
In this example, we:
- used
archiveList archives with type="related" limit="5"To declare to get the related documents and store the results inarchivesthe variable, while limiting the display quantity to 5 items. - By
{% for item in archives %}Loop through each related document. item.LinkGet the document link,item.TitleGet the document title,item.ThumbRetrieve thumbnails,item.DescriptionGet the document description (and through)truncatechars:80Truncate to display the first 80 characters),item.CreatedTimeGet the publish time (through)stampToDateFormatted),item.ViewsView the number of page views.{% empty %}The clause elegantly handles the scenario where there is no relevant content, displaying a friendly prompt to the user, thus improving the user experience.
You can add as needed,like="keywords"orlike="relation"Parameters to switch the matching logic of related content. For example, to recommend based on keywords:{% archiveList archives with type="related" like="keywords" limit="5" %}
To recommend based on manually set associations in the background:{% archiveList archives with type="related" like="relation" limit="5" %}
Summary
AnQiCMS'archiveListLabel collaborationtype="related"The pattern provides great flexibility and convenience for website operators, making content recommendations simple and efficient.It can help you build a website with interconnected content and smooth user experience, whether it is relying on the system to automatically discover, intelligent matching based on keywords, or manual precise association by the operator.By reasonably utilizing this feature, you can effectively guide users to engage in in-depth browsing, enhance content value, and lay a solid foundation for the SEO optimization of the website.
Frequently Asked Questions (FAQ)
Q1: Why is my document detail page not displaying any related content, even though I addedtype="related"the tag for the pattern?A1: If the related content is not displayed, please check the following points:
- Label position:Ensure
type="related"The label is placed inDocument detail pagethe template because its matching logic depends on the context of the current document. - Content matching conditions:
- Default mode:Check if there are other documents under the current document's category, and whether these documents are "close" to the current document (for example, with similar publication times).
- Keyword pattern (
like="keywords"):Confirm that the current document and the target related documents are set to the same.first keyword. - Manual association mode (
like="relation"):Check if the current document has manually associated other documents during background editing.
- **Number of contents