If a visitor reads an interesting document or views a product introduction on your website and can get more relevant recommendations in time, it will undoubtedly greatly enhance their visit experience, extend their stay time, and encourage them to explore more corners of the website.Aqie CMS knows this and provides a variety of flexible functions to help you cleverly display related recommendations on the document detail page and customize the recommendation logic according to your operational strategy.

Next, we will discuss in detail how to implement this feature in AnQi CMS.

Understand the 'related recommendations' in AnQi CMS.

In AnQi CMS, the related recommendations on the document detail page mainly depend onarchiveListThis powerful tag. By reasonably configuring its parameters, you can easily implement a variety of recommendation strategies. The most direct way is to usetype="related"The parameter allows the system to intelligently find the content closest to the current document.

1. Basic document recommendations

First, you need to locate the template you are currently using, typically the template file path of the document detail page is like/template/{模型table}/detail.html. For example, if it is an article model, it may be/template/article/detail.html.

In this template file, you can insert the following code snippet below the document content or in the sidebar, etc., to display the system's default related document recommendations:

<div class="related-documents">
    <h3>相关推荐</h3>
    <ul>
        {% archiveList relatedDocs with type="related" limit="5" %}
            {% for item in relatedDocs %}
            <li>
                <a href="{{ item.Link }}">{{ item.Title }}</a>
            </li>
            {% endfor %}
        {% empty %}
            <li>暂无相关推荐。</li>
        {% endarchiveList %}
    </ul>
</div>

This code will retrieve 5 documents related to the current document (the system will automatically identify the current document ID).type="related"The parameter allows AnQi CMS backend logic to automatically judge which content is "related", usually based on factors such as the same category, the same keywords, and intelligent matching.

Custom recommendation logic: Make recommendations understand your users better

Of Security CMSarchiveListTags are not limited to default related recommendations, they also providelikeParameters and other rich filtering conditions, allowing you to finely control the recommended content.

2. Smart recommendation based on keywords

If you want to recommend content that is more focused on the keyword matching degree of the document, you can uselike="keywords"Parameters. This means that the system will match the keywords of the current document with the keywords of other documents to find recommendations with more consistent content themes.

Back-end settings:When editing documents in the AnQi CMS backend, be sure to fill in accurate and representative keywords in the "Document Keywords" field, with multiple keywords separated by English commas.,The quality of the keywords directly affects the accuracy of the recommendations.

Template code:

<div class="related-by-keywords">
    <h3>更多您可能感兴趣的</h3>
    <ul>
        {% archiveList keywordsRelated with type="related" like="keywords" limit="5" %}
            {% for item in keywordsRelated %}
            <li>
                <a href="{{ item.Link }}">{{ item.Title }}</a>
            </li>
            {% endfor %}
        {% empty %}
            <li>暂无更多相关内容。</li>
        {% endarchiveList %}
    </ul>
</div>

3. Precise recommendations based on manual association in the background.

Sometimes, you may want to manually specify the relevance between certain documents, such as product series recommendations, recommended articles on specific topics, etc. Anqi CMS provides the function to manually set "related documents" in the background, you can throughlike="relation"Parameters to call this manually associated content.

Back-end settings:When editing documents in the Anqi CMS backend, you will usually find the option 'Related Documents' in the 'Other Parameters' or similar collapsible panel.Here, you can manually search and select other documents related to the current document.This method provides the highest recommendation accuracy, fully controlled by the operator.

Template code:

<div class="manually-linked-recommendations">
    <h3>为您精选</h3>
    <ul>
        {% archiveList manualRelated with type="related" like="relation" limit="5" %}
            {% for item in manualRelated %}
            <li>
                <a href="{{ item.Link }}">{{ item.Title }}</a>
            </li>
            {% endfor %}
        {% empty %}
            <li>运营者暂未手动配置相关推荐。</li>
        {% endarchiveList %}
    </ul>
</div>

4. Flexible recommendation based on category, recommendation attributes, or other conditions.

excepttype="related"With intelligent or manual association, you can also use.type="list"Combine other parameters to create a recommendation list based on categories, recommendation attributes (such as "Top Stories", "Recommendations"), and even views and other indicators.This is a more general way of calling a list, but it can also be used as a supplement to related recommendations.

Back-end settings:

  • Document classification:When publishing or editing a document, make sure the document category is accurate and correct.
  • Recommended properties:On the document editing page, you can select 'recommended properties' for the document, such as 'recommended[c]', 'slide[f]', and so on.
  • Views:This is an automatically generated indicator, no additional settings are required.

Template code example (recommend browsing the top 5 articles in the current category, but excluding this document):

Firstly, we need to obtain the category ID and document ID of the current document in order to filter and exclude.

”`twig {% archiveDetail currentArchive with name=“Id” %} {# Get the ID of the current document #} {% archiveDetail currentCategory with name=“CategoryId” %} {# Get the category ID of the current document #