In content management and website operations, how to effectively attract visitors, extend their stay on the site, and guide them to discover more interesting content is a crucial issue.AnQiCMS provides a powerful and flexible mechanism, which helps us easily display the related recommended content list on the current article page, thereby greatly improving the user experience and the overall performance of the website.
Core mechanism:archiveListlabel'stype="related"property
AnQiCMS achieves content recommendation in the most direct and effective way by utilizing its powerfularchiveListtags, and cooperatetype="related"Property. When we are on an article detail page, this tag can intelligently recognize the current article and automatically fetch other related content.
By default,type="related"Based on the category of the current article, it recommends some nearby articles in the same category, which is a very basic and practical relevance judgment. But if you need more accurate recommendations, AnQiCMS also provideslikeParameters to refine the recommendation logic:
like="keywords":If you fill in keywords for the article when publishing it in the background (these keywords are usually also used for SEO optimization), thenarchiveListYou can use these keywords to find other articles with similar keywords for recommendation. This makes the recommended content more closely aligned with the theme of the article.like="relation":For recommendation scenarios that require manual intervention, this parameter comes into play.You can manually specify other articles related to the current article when editing articles on the AnQiCMS backend. This way,archiveListOnly show the content you explicitly specify, achieving highly customized recommendations.
It is very intuitive to call such recommended content in the template. You just need to add it at the appropriate position in the article detail page.archiveListtags, and specifytype="related"andlimit(Control the number of displays), for example:
{# related 相关文档列表展示 #}
<div>
<h3>相关推荐</h3>
<ul>
{% archiveList archives with type="related" limit="5" %}
{% for item in archives %}
<li>
<a href="{{item.Link}}">
<h5>{{item.Title}}</h5>
<p>{{item.Description}}</p>
{% if item.Thumb %}
<img alt="{{item.Title}}" src="{{item.Thumb}}">
{% endif %}
</a>
</li>
{% empty %}
<li>暂无相关推荐内容。</li>
{% endfor %}
{% endarchiveList %}
</ul>
</div>
In this code block,archivesis an array that contains recommended article information. You can easily obtain the titleitem.Title), link (item.Link),and thumbnail (item.Thumb) and brief descriptionitem.Description) of each article, and display them according to your page design.limit="5"It restricted the maximum display of 5 recommended items.
Enhance relevance: strategy using tags (Tags)
exceptarchiveListoftype="related"Outside of the properties, the tag feature of AnQiCMS is also a powerful tool for building related content lists. Tags can thematize content, allowing articles on the same topic to be associated with each other.
In the AnQiCMS backend, when you publish or edit an article, you can add multiple 'tags'.These tags are somewhat similar to topics, which can link content scattered in different categories through common keywords.For example, an article about 'SEO optimization techniques' can be tagged with 'SEO', 'website promotion', 'marketing strategy', and so on.
AlthougharchiveList type="related"Already intelligent, but if you want to recommend content strictly based on certain specific tags, you can adopt the following strategies:
- Display the tags of the current article:Firstly, you can display the list of tags associated with the current article on the article detail page. This itself can provide readers with clues for further exploration.
<div> <strong>当前文章标签:</strong> {% tagList tags with itemId=archive.Id limit="10" %} {% for item in tags %} <a href="{{item.Link}}">{{item.Title}}</a> {% endfor %} {% endtagList %} </div> - More articles based on tags:Next, you can combine
tagDataListTags. Although this is usually used on tag detail pages