As a website operator who is well-versed in the operation of AnQiCMS, I know that high-quality content and user experience play a crucial role in the success of a website.The associated articles can not only effectively extend the user's stay time on the site and increase the page view volume, but also benefit the internal link optimization (SEO) of the website.AnQiCMS provides a flexible way to retrieve and display these related contents, meeting the operation needs of different scenarios.

Overview of the mechanism for linking articles in AnQiCMS

In AnQiCMS, the associated articles are mainly obtained through the corearchiveListTemplate tag implementation. This tag has powerful filtering and sorting capabilities and can pull article lists based on various conditions, including those specifically used for associating articles.type="related"Parameters. By adjustingarchiveListThe parameter allows us to easily implement article recommendations based on classification, keywords, or manual association in the background.This provides great freedom for operators to ensure that users can always find more content they are interested in.

According to the article category to get related articles

The most common way to associate articles is to recommend them based on the category they belong to.When the user browses a specific article, they are usually also interested in other articles in the same category.archiveListTags to search for other articles in the category.

Firstly, we need to get the current article's category ID in the template. This can be done byarchiveDetailLabel implementation. Once we obtain the category ID, we can use it asarchiveListTagscategoryIdParameter value. For example, if the category ID of the current article is123, we can setcategoryId="123"Pull articles under this category. At the same time, to avoid duplicate display of the current article, we usually also need to configure the related article list in the background with appropriate filtering.limitThe parameter can control the number of articles displayed, ensuring the simplicity and efficiency of the related article area.

Get related articles based on keywords or tags

In addition to categories, keywords or tags are also important links connecting the content of articles.AnQiCMS allows us to intelligently recommend related content based on the current article's keywords.This method is especially effective for articles that belong to different categories but have similar themes.

To implement keyword-based related article recommendation, we still usearchiveListTags, and settype="related". Based on this, by addinglike="keywords"Parameter, AnQiCMS will automatically parse the keywords or Tags of the current article and search for other articles with similar content accordingly.This means that if multiple articles use the same core keywords or Tags, they will be associated with each other, forming a content matrix that greatly enhances the discoverability of content.The importance of precisely setting keywords and tags when publishing articles is fully demonstrated at this moment.

By manually associating articles

In some special cases, website operators may need to finely control the display of related articles, for example, when promoting specific content, creating special topic pages, or guiding users to read specific series of articles.AnQiCMS provides a manual association article feature.

When it is necessary to explicitly specify related articles for an article in the background, it can be done by utilizingarchiveListlabel combined withtype="related"andlike="relation"Parameter.This means that the system will no longer automatically calculate relevance based on categories or keywords, but will only display those articles that are manually specified by the operations team as relevant content for the current article in the backend editing interface.This feature grants the most freedom to operation personnel, enabling them to accurately guide users to preset content paths and implement more complex operational strategies.

Practical examples of calling related articles in AnQiCMS templates

To more intuitively demonstrate how to obtain and display related articles in the AnQiCMS template, here is a comprehensive example.Assuming we are at the bottom of an article detail page, we want to display articles under the same category that are recommended based on keywords and manually associated.

{# 首先,获取当前文章的ID和分类ID #}
{% archiveDetail currentArticleId with name="Id" %}
{% archiveDetail currentCategoryId with name="CategoryId" %}

<div class="related-articles-section">
    <h3>更多相关文章</h3>

    {# 方式一:根据当前文章分类ID获取关联文章 #}
    <div class="related-by-category">
        <h4>同类推荐</h4>
        <ul>
            {% archiveList categoryRelatedArchives with categoryId=currentCategoryId type="list" limit="5" %}
                {% for item in categoryRelatedArchives %}
                    {# 排除当前文章本身 #}
                    {% if item.Id != currentArticleId %}
                        <li>
                            <a href="{{item.Link}}">{{item.Title}}</a>
                            <span>- {{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
                        </li>
                    {% endif %}
                {% empty %}
                    <li>暂无同分类文章。</li>
                {% endfor %}
            {% endarchiveList %}
        </ul>
    </div>

    {# 方式二:根据关键词智能推荐关联文章 #}
    <div class="related-by-keywords">
        <h4>关键词推荐</h4>
        <ul>
            {% archiveList keywordRelatedArchives with type="related" like="keywords" limit="5" %}
                {% for item in keywordRelatedArchives %}
                    {# 排除当前文章本身 #}
                    {% if item.Id != currentArticleId %}
                        <li>
                            <a href="{{item.Link}}">{{item.Title}}</a>
                            <span>- {{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
                        </li>
                    {% endif %}
                {% empty %}
                    <li>暂无关键词相关文章。</li>
                {% endfor %}
            {% endarchiveList %}
        </ul>
    </div>

    {# 方式三:手动关联的文章 #}
    <div class="related-by-manual">
        <h4>精选推荐</h4>
        <ul>
            {% archiveList manualRelatedArchives with type="related" like="relation" limit="5" %}
                {% for item in manualRelatedArchives %}
                    {# 排除当前文章本身 #}
                    {% if item.Id != currentArticleId %}
                        <li>
                            <a href="{{item.Link}}">{{item.Title}}</a>
                            <span>- {{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
                        </li>
                    {% endif %}
                {% empty %}
                    <li>暂无手动关联文章。</li>
                {% endfor %}
            {% endarchiveList %}
        </ul>
    </div>
</div>

In this example, we first obtained the current article'sIdandCategoryId. Then, we used the tag three timesarchiveListwith differenttypeandlikeParameters combination to pull related articles under different logic. In each iteration, we go through{% if item.Id != currentArticleId %}Ensure that the article being read is not displayed repeatedly.{% empty %}Label elegantly handles the situation where no associated articles are found, improving user experience.

Operation suggestions to enhance the effect of associated articles

As an operations staff, simply implementing the call to related articles is not enough, we also need to think about how to maximize its effect.

Firstly, the display position of the associated article is crucial.通常,它们会出现在文章内容下方、侧边栏或文章末尾,确保用户在完成当前内容阅读后能够自然地发现更多相关信息。其次,展示数量应适中,通常建议显示3到8篇,避免信息过载或信息量不足。The attractiveness of the title and thumbnail also directly affects the click-through rate, therefore ensure that associated articles have high-quality cover images and concise, clear titles.

In addition, regularly reviewing and optimizing keywords and tags is a long-term mechanism for improving the accuracy of keyword recommendations.For manual association, it should be combined with data analysis to associate the key content of the content or user conversion path, in order to achieve **operation effect.Through these flexible tools provided by AnQiCMS, combined with refined operational strategies, associated articles will become an indispensable part of your website's content ecosystem.


Common Questions (FAQ)

问:Why are my related articles not displayed or displayed inaccurately?答:关联文章不显示或不准确可能有几个原因。首先,请检查您的模板代码是否正确使用了 EnglisharchiveList标签及其参数,特别是 EnglishcategoryId/typeandlikeEnglish.Next, confirm whether the current article has associated content, such as other articles in the same category, whether the keywords/tags are set correctly, or whether other content is manually associated with the article in the background.like="keywords"Pattern, make sure the keywords in the article are set accurately and richly.If the problem still exists, it is recommended to check the AnQiCMS background log to see if there are any related error messages.

问:Can I display multiple types of related articles on one page at the same time? For example, some are from the same category, and some are based on keywords?答:Absolutely. As shown in the practical example of the article, you can call it multiple timesarchiveListtags, setting different parameters each time (for example, once settingcategoryId, and another time settingtype="related"andlike="keywords"),to retrieve and display the associated article lists under different logic.This combination of use can provide users with more diverse recommended content, further improving the efficiency of content discovery and user satisfaction.

问:AnQiCMS是否会自动排除当前正在阅读的文章,避免其在关联文章列表中重复出现?Answer: AnQiCMS'sarchiveListLabels do not automatically exclude the current article when retrieving related content. As an operator, you need to manually add logic to the template code to exclude the current article. This is usually done by inforAdd condition judgment within the loop, for example{% if item.Id != currentArticleId %}where,currentArticleIdis the one you pass througharchiveDetailThe current article ID obtained by the tag. This handling ensures the smoothness of user experience and avoids unnecessary repetition.