In content management and website operation, how to effectively improve user experience, extend the stay time of visitors on the site, and optimize the efficiency of search engine crawling is a key concern for each operator.Whereas displaying highly relevant recommended content to the current article is undoubtedly an effective method.AnQiCMS as an efficient content management system, fully considers this requirement, and provides flexible and powerful functions to easily achieve this goal.
Core Function Analysis:archiveListThe magic use of tags
AnQiCMS provides powerful template tags, allowing you to build complex page structures and data displays without delving into programming. When implementing the feature of related article lists, archiveListTags are your core weapon. It can not only list the regular article list, but also intelligently filter and display content highly relevant to the current article through its unique parameter configuration.
The key to implementing the list of related articles isarchiveListthe tag intype="related"Parameters. When you use this parameter on the article detail page, AnQiCMS will automatically identify the current article and recommend other articles according to the associated logic you set.
Understand the association logic: keywords and manual settings
AnQiCMS provides two main association logics to determine which articles are 'related':
Method one: Intelligent Association Based on Keywords
AnQiCMS can intelligently find other articles with similar themes based on the keywords and Tag tags set in the article.This method utilizes the intrinsic connection of the content, and the recommended results are usually more aligned with the reader's interests.
To enable Intelligent Association Based on Keywords, you need toarchiveListthe label uselike="keywords"Parameters. The system will use the keywords and Tag information of the current article as the core basis, automatically match and recommend similar articles.
To make this intelligent association more accurate, it is recommended that you fully utilize the "Document Keywords" and "Tag Tags" functions when publishing content.Add precise and rich keywords and Tags to each article, which not only helps in recommending related articles but also is an important means to improve SEO effectiveness.
代码示例:根据关键词推荐相关文章
{# 假设这是文章详情页的模板,此代码块将显示基于关键词推荐的5篇文章 #}
<div class="related-articles">
<h2>相关推荐</h2>
<ul>
{% archiveList relatedArticles with type="related" like="keywords" limit="5" %}
{% for item in relatedArticles %}
<li>
<a href="{{item.Link}}" title="{{item.Title}}">
{% if item.Thumb %}<img src="{{item.Thumb}}" alt="{{item.Title}}" class="article-thumb">{% endif %}
<h3>{{item.Title}}</h3>
<p class="description">{{item.Description|truncatechars:80}}</p>
<div class="meta">
<span>{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
<span>{{item.Views}} 阅读</span>
</div>
</a>
</li>
{% empty %}
<li>暂无相关推荐。</li>
{% endfor %}
{% endarchiveList %}
</ul>
</div>
方法二:编辑精心策划的手动关联
In some specific scenarios, you may want to control more accurately which articles should be associated with each other, for example, you are promoting a series of products, or you need to guide users to read specific content paths.AnQiCMS also provides this flexibility, allowing you to manually select related articles in the background article editing interface.
When you want the system to only display the articles you manually selected or associated in the background article detail page, you can usearchiveListTagslike="relation"Parameters. This ensures the absolute accuracy of the recommended content, fully in line with your operational intentions.
Code example: according to manually associated recommendations related articles
{# 假设这是文章详情页的模板,此代码块将显示手动关联的3篇文章 #}
<div class="manual-related-articles">
<h2>精选推荐</h2>
<ul>
{% archiveList handpickedArticles with type="related" like="relation" limit="3" %}
{% for item in handpickedArticles %}
<li>
<a href="{{item.Link}}" title="{{item.Title}}">
{% if item.Logo %}<img src="{{item.Logo}}" alt="{{item.Title}}" class="article-logo">{% endif %}
<h4>{{item.Title}}</h4>
<p class="meta">分类:{% categoryDetail with name="Title" id=item.CategoryId %}</p>
</a>
</li>
{% empty %}
<li>暂无精选推荐。</li>
{% endfor %}
{% endarchiveList %}
</ul>
</div>
Flexible Application: Customized Article List
In addition to the two core association methods mentioned above,archiveListTags also provide various parameters to help you refine the display of related article lists:
limit: 控制显示数量。您可以设置limit="5"来显示 5 篇文章,或者limit="3,7"来从第 3 篇文章开始显示 7 篇。moduleId: 限制推荐内容来自特定内容模型。例如,moduleId="1"仅显示“文章”模型下的相关内容。categoryId: 将推荐内容限制在特定分类下。比如,categoryId="10"Only display articles related to the current article and belong to category ID 10.excludeCategoryId: Exclude articles from certain categories. If you do not want articles from a specific category to appear in related lists, you can use this parameter.flag: Based on the recommended attributes of the article (such as headline, recommended, slideshow, etc.) for filtering. For example,flag="c"Only display articles marked as 'recommended'.order: Adjust the sorting method of related articles. Althoughtype="related"it has its internal sorting logic by default, but you can also try usingorder="views desc"sort in descending order by views, ororder="id desc"sort by the latest release.
Through the combination of these parameters, you can create highly customized, more attractive related article lists based on the actual needs and content operation strategy of the website.
Summary
AnQiCMS 通过其强大的 EnglisharchiveListTags and flexible parameter configuration provide you with multiple ways to display related article lists.Whether it is the intelligent keyword matching of the dependent system or the precise recommendation through manual settings, it can help you effectively enhance the content depth and user engagement of the website.Make good use of these features, which will make your website content more vibrant and easier to gain the favor of search engines.
Common Questions (FAQ)
Q1: Why is the related articles list not displayed on my article detail page?
A1: Please check the following points:
- Is the template code correct:Make sure you have set
archiveListTags andtype="related"Parameter added to the template file of the article detail page, and the syntax is correct. - Article keyword/Tag:If you are using
like="keywords"Please confirm whether the article itself has set keywords or Tags, and whether there are other articles associated with these keywords/Tags. - Manual association settings:If you are using
like="relation"Please check if you manually associated other articles while editing the current article in the background. - Number of contents:Ensure that your website has enough content so that the system can find enough relevant articles for recommendation.
Q2:like="keywords"How is the similarity of articles judged?
A2: When you uselike="keywords"Parameters, AnQiCMS will first retrieve the "Document Keywords" and "Tag Tags" set in the current article. Then, it will search for other articles in the entire content library that contain these keywords or tags, and sort them based on match degree, publish time, and other factors, finally,