How to display a list of recommended articles related to the current article content, supporting keyword search or manual association?

As an experienced security CMS website operator, I know the importance of high-quality content and precise recommendations for improving user experience and website SEO.In the article detail page, effectively displaying recommended articles related to the current content can not only extend the user's visit time and reduce the bounce rate, but also optimize and enhance the page weight and crawling efficiency through internal links.AutoCMS provides flexible tags, supporting us to build this recommendation list through keywords or manual methods.

Implementing related article recommendations in Anqi CMS

The Anqi CMS provides a powerful template tag system, especiallyarchiveListtags, offering us a powerful tool for implementing related article recommendations. On the article detail page, we can usetype="related"This parameter is used to call a recommendation list related to the current article content. This tag has the ability to automatically associate with intelligence, and also supports our fine-grained manual control.

Based on keyword automatic association recommendation articles

By default, when we use it on the article detail pagearchiveListLabel and settype="related"When, AnQi CMS will intelligently select and recommend other articles closest to the content of the current article based on the classification, tags, and content similarity of the current article, automatically.This method is particularly efficient for websites with large amounts of content and similar article topics, as it can automatically complete most of the related work, greatly reducing the burden of manual maintenance.

If we need to use keywords more accurately for automatic association, we canarchiveListLabel further specificationlike="keywords"Parameter.This means that the system will match the keywords of the current article with other article keywords, thereby filtering out more relevant recommended content.This method requires us to ensure the accuracy and richness of keywords when publishing articles, so that the automatic recommendation effect will be better.For example, if the current article discusses "Anqi CMS template creation

Manually associate recommended articles to enhance control

In addition to automatic association, Aiqi CMS also provides the option to manually associate recommended articles, which means we have greater control over the recommended content for our operation staff.When there is a strong correlation between certain specific articles, or when we want to promote certain specific content, manual association becomes particularly important.

To implement manual association, we need to inarchiveListsetting in the labeltype="related"Increase at the same time,like="relation"

The following is an example of code that displays a list of related articles in an Anqi CMS template, which combines the logic of automatic keyword association and manual association.

{# 假设这是文章详情页,archive变量已包含当前文章数据 #}

<section class="related-articles">
    <h2>相关推荐</h2>
    <ul>
        {# 尝试首先通过手动关联来获取推荐文章,如果后台有设置 #}
        {% archiveList manualRelations with type="related" like="relation" limit="5" %}
            {% for item in manualRelations %}
                <li>
                    <a href="{{ item.Link }}">
                        {% if item.Thumb %}<img src="{{ item.Thumb }}" alt="{{ item.Title }}"/>{% endif %}
                        <h3>{{ item.Title }}</h3>
                        <p>{{ item.Description|truncatechars:80 }}</p>
                    </a>
                </li>
            {% endfor %}
        {% endarchiveList %}

        {# 如果手动关联文章不足或没有设置,则通过关键词自动获取 #}
        {% archiveList keywordRelations with type="related" like="keywords" limit="5" %}
            {% for item in keywordRelations %}
                <li>
                    <a href="{{ item.Link }}">
                        {% if item.Thumb %}<img src="{{ item.Thumb }}" alt="{{ item.Title }}"/>{% endif %}
                        <h3>{{ item.Title }}</h3>
                        <p>{{ item.Description|truncatechars:80 }}</p>
                    </a>
                </li>
            {% endfor %}
        {% endarchiveList %}

        {# 如果上述两种方式都未能提供足够内容,可以退而求其次,获取同分类最新文章 #}
        {% archiveList fallbackArticles with categoryId=archive.CategoryId type="list" order="id desc" limit="5" %}
            {% for item in fallbackArticles %}
                {# 排除当前文章本身 #}
                {% if item.Id != archive.Id %}
                    <li>
                        <a href="{{ item.Link }}">
                            {% if item.Thumb %}<img src="{{ item.Thumb }}" alt="{{ item.Title }}"/>{% endif %}
                            <h3>{{ item.Title }}</h3>
                            <p>{{ item.Description|truncatechars:80 }}</p>
                        </a>
                    </li>
                {% endif %}
            {% endfor %}
        {% endarchiveList %}
    </ul>
</section>

In actual operation, the reasonable use of related article recommendation lists can significantly improve user activity on the website.Suggest that we prioritize manual association to ensure the exposure of core content, and then use keyword automatic association to cover a wider range of related topics.At the same time, regularly reviewing the effectiveness of recommendations and adjusting the association strategy based on user behavior data will help to continuously optimize the user experience and the effectiveness of content marketing.

Common Questions (FAQ)

Why is my related article list not displaying any content?

If the related article list is empty, please first check if the current article is on the detail page (archiveDetailcontext) becausetype="related"Labels are only effective on this type of page. Next, confirm that the article has been published and is visible. If usinglike="keywords", please check if the article has set keywords; if usinglike="relation"Please confirm in the background article editing page whether other articles have been manually associated. Finally, ensure that the spelling of template tags and parameter settings are correct.

Can I mix and use automatic keyword association and manual association?

Yes, you can mix and use.In the template, you can first try to associate articles manually, and if the number is insufficient, supplement them through the keyword auto-association method.As shown in the code example above, through nesting or conditional judgment, you can flexibly control the priority and source of recommended content to achieve ** the user experience and operation goals.

What is the sorting logic of the related articles? Can I control its sorting?

When usingtype="related"When, the default sorting logic is based on the system's intelligent judgment of relevance. However,archiveListTags themselves supportorderparameters, such asorder="views desc"(Sorted by view count in reverse order) ororder="id desc"(Sorted by publishing time in reverse order). You can try toorderParameters withtype="related"Combined use, but please note that for certain types of relevance calculations (such aslike="relation"or the default nearest document), the sorting effect may be limited by internal logic. **Practice is to let the system filter according to relevance first, and then apply your sorting preferences on this basis.