How to get and display a list of recommended articles related to the current article?

Calendar 👁️ 64

In website operation, when we toil hard to create an article, naturally, we hope that it can be seen by more readers and guide them to explore more wonderful content.On the bottom or sidebar of the article detail page, cleverly display recommended content related to the current article, which can not only significantly improve the depth and duration of user reading, but also bring many benefits to search engine optimization (SEO).AnQiCMS (AnQiCMS) fully understands this need, providing extremely convenient and powerful tags to help us easily achieve this goal.

Smart usearchiveListTag to get related articles

In AnQi CMS, to obtain and display a list of recommended articles related to the current article, we mainly usearchiveListThe tag is the core tool we use to call various article lists in the template, and it has a special attributetype="related"It is designed to achieve article recommendation.

When we are in the template of the article details page (usuallydetail.htmlUsed inarchiveListtags and settype="related"When the property is set, the AnQi CMS will work intelligently. It will automatically select the most similar articles in the same category based on the current article's category, content, publication time, and other factors, and display them as a recommendation list.This default smart recommendation method saves us a lot of trouble in manual selection.

For example, you can add a 'related recommendations' module at the bottom of the article details page, the code will be like this:

{# 在文章详情页的模板中,例如 detail.html #}
<div class="related-articles-section">
    <h3>相关推荐</h3>
    <ul>
    {% archiveList archives with type="related" limit="5" %}
        {% for item in archives %}
        <li>
            <a href="{{item.Link}}">{{item.Title}}</a>
            {# 还可以显示其他信息,例如发布时间、简介等 #}
            <p>{{item.Description|truncatechars:80}}</p>
            <span>发布于: {{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
        </li>
        {% endfor %}
    {% endarchiveList %}
    </ul>
</div>

In this code block,limit="5"We hope to recommend 5 articles in the list. You can adjust this number according to the page layout and requirements.item.LinkThe access link to the article will be automatically generated,item.TitleThe article title. To make the list richer, we also displayed a brief description of the article (item.Description) and the publication date (item.CreatedTimethrough.stampToDateFormatted).

Deep customization: Improve recommendation accuracy

In addition to the default intelligent recommendation, Anqi CMS also provides more refined control methods to meet specific operational needs.

1. Precision recommendation based on keyword association

To make the recommended content more accurately match the reader's interests, AnQi CMS allows us to associate recommendations through the keywords of the articles.When you edit articles in the background, the keywords you fill in come into play.archiveListlabel'slike="keywords"The attribute will indicate to the system to prioritize searching for articles that share the same keywords as the current article. It is worth noting that the system will default to the current article'sfirst keywordAs a basis for matching to find related content.

If you want the recommendation list to focus more on keyword matching, you can modify the code in this way:

{# 基于关键词的推荐 #}
<div class="related-by-keywords">
    <h3>更多您可能感兴趣的</h3>
    <ul>
    {% archiveList archives with type="related" like="keywords" limit="5" %}
        {% for item in archives %}
        <li>
            <a href="{{item.Link}}">{{item.Title}}</a>
            <small>{{item.Keywords}}</small>
        </li>
        {% endfor %}
    {% endarchiveList %}
    </ul>
</div>

Bylike="keywords"The system will try to find other articles related to the current article's keywords, thus providing more focused recommendations.

2. Manually associate with selected recommended articles.

For some special cases, such as when you want to strongly recommend several specific articles or manually create a series of related special topics, AnQi CMS also provides a flexible solution.On the article backend editing interface, there is a "related documents" setting item, where you can manually associate other articles.Once set, you can pass through in the templatelike="relation"This attribute is used to call these manually specified associated articles.

This way, the operator has absolute control, can accurately display recommended content based on content strategy or business needs:

{# 手动指定相关文章 #}
<div class="editor-picks">
    <h3>编辑精选</h3>
    <ul>
    {% archiveList archives with type="related" like="relation" limit="5" %}
        {% for item in archives %}
        <li>
            <a href="{{item.Link}}">{{item.Title}}</a>
            {# 您可以在这里添加更多描述,突出精选理由 #}
        </li>
        {% endfor %}
    {% endarchiveList %}
    </ul>
</div>

here,like="relation"Ensure that only the articles you manually associate in the background will be displayed. If an article is not manually associated, the list may not display content.

Combine images to make the recommendation list more attractive

A good recommendation list, besides the text title, adding eye-catching thumbnails will greatly increase the click-through rate. You can easily integrate article thumbnails into the recommendation list:

`twig {# Combine image and more information recommendation list #} <div class="top-

Related articles

How to display the link to the previous and next article on the article detail page?

It is an important link in the article detail page of AnQi CMS to display "Previous" and "Next" navigation links, which helps improve the user experience and the internal link structure of the website.This not only guides readers to continue browsing related content and extend their stay time, but also helps search engines better understand the relevance between website content, which has a positive effect on SEO optimization.AnQi CMS provides a user-friendly and powerful template tag system

2025-11-08

How to call and display a document list in a template, and perform sorting and filtering?

Manage and display website content in AnQi CMS, especially document lists, is a very common need in daily operation.Strong and flexible template tags provided by AnQi CMS, allowing us to easily call and display this content on the website front-end, and sort and filter as needed.This article will deeply explore how to use the template function of Anqi CMS to achieve these goals and make your website content display more attractive.### Core Function: `archiveList` tag - Display the basic document content To display the document list

2025-11-08

How to retrieve and display the complete content and images of a specific single page?

Use AnQiCMS to manage and display website content, especially when dealing with independent and rich single-page content such as "About Us" and "Contact Information", its flexibility and powerful functions are particularly prominent.We often need to present the text, images, and even image sets of these pages in their entirety on the website, and AnQiCMS provides a very intuitive way to achieve this. Let's explore together how to retrieve and display the complete content and images of a specific single page in AnQiCMS, making your website content more vivid and diverse.## Content Creation

2025-11-08

How to list and display the titles and links of all single pages?

AnQi CMS provides a user-friendly and powerful content management system, where the single-page feature is an ideal choice for building independent pages such as "About Us", "Contact Information", or "Privacy Policy".When you need to display the titles and links of these single-page in a centralized position on the website, such as in the footer navigation, sidebar, or a dedicated page index, the template tags of AnQiCMS can help you easily achieve this.In the AnQiCMS backend, single-page content is created and maintained under "Page Resources" > "Page Management".You can easily add to the website like 'About Us'

2025-11-08

How to display the content of custom fields (such as author, source) on the article detail page?

In website operation, the article detail page is not only a place to display the core content, but also a key to convey additional information, enhance professionalism, and improve user experience.In addition to the title and body, we often need to display some custom fields on the article detail page, such as author, source, publisher, product model, and so on.This information not only enriches the content of the article, but also helps to enhance the authority and credibility of the website, even having a positive impact on SEO optimization and user decision-making.AnQiCMS (AnQiCMS) is designed with a flexible content model, making the display of these custom fields very intuitive and powerful

2025-11-08

How to use Tag tags to associate and display related content on the front end?

In Anqi CMS, content organization and association is the key to enhancing website value, optimizing user experience, and improving search engine performance.In addition to the traditional classification structure, we also have a very powerful and flexible tool - Tag tag.It is like a 'living index' of content, which helps us to connect scattered content in multiple dimensions, making it easier for users to find the information they are interested in.Today, let's talk about how to make full use of Tag tags on the front end to associate and display our wonderful content.### Tag label: Flexible content association bridge Different from a strict classification system

2025-11-08

How to implement the pagination display function of the article comment list?

In website operation, effectively managing and displaying user comments is crucial for enhancing user interaction and content vitality.AnQiCMS (AnQiCMS) is a powerful content management system that provides flexible template tags, allowing us to easily implement pagination display of article comment lists.This article will introduce in detail how to implement this feature through template tags in Anqi CMS, thus providing users with a better browsing experience.Understanding the core of comments and pagination In the Anqi CMS template system, implementing pagination display of article comment lists

2025-11-08

How to display the message form submitted by users on the website?

A highly efficient and flexible mechanism is provided by Anqi CMS to easily display and manage user message forms on your website.Whether it is to collect user feedback, consultation, or simple interactive messages, Anqi CMS can help you quickly implement this function and customize it according to your business needs. ### Learn about the Anqi CMS message function In the Anqi CMS backend management interface, you can find the "Website Message" option under the "Function Management" menu.This is the core area where you manage all comment-related settings, including viewing submitted comments and customizing form fields

2025-11-08