How to display the article list according to the article views, publish time, or backend custom sorting?

Calendar 👁️ 74

In website operation, the display method of the article list directly affects user experience and the efficiency of content reach.A well-organized list of articles that can highlight key points, significantly improving user retention and information acquisition efficiency.AnQiCMS as a flexible content management system provides powerful article list display functions, which can flexibly filter content and freely adjust the sorting method of articles according to your content strategy, making your website content more attractive.

Core feature: Dynamic sorting of the article list

AnQiCMS through its corearchiveListTemplate tags provide us with great flexibility to control the display of articles.This tag is not only responsible for the output of content, but also the key to managing content sorting.Next, we will discuss how to use this tag to adjust the display order of articles according to different operational needs.

First, sorted by views: popular content is presented easily

To enable users to quickly find the popular content on the website, sorting articles by views (Views) is an excellent choice.When a piece of content receives more attention, highlighting it can effectively attract new visitors and enhance the overall activity of the website. InarchiveListtags, you just need to simply setorderthe parameter. For example,order="views desc"The articles will be arranged according to the number of views from high to low. This means that the articles with the highest user engagement will be presented to visitors first, bringing sustained traffic to the website.

{# 显示浏览量最高的10篇文章 #}
{% archiveList archives with type="page" order="views desc" limit="10" %}
    {% for item in archives %}
        <div class="article-item">
            <h3><a href="{{ item.Link }}">{{ item.Title }}</a></h3>
            <p>浏览量: {{ item.Views }}</p>
            <p>{{ item.Description }}</p>
        </div>
    {% endfor %}
{% endarchiveList %}

This setting can help you quickly build a "hot articles" or "rankings" area, so that your excellent content gets the exposure it deserves and effectively guides users to explore more wonderful content.

Second, sort by publish time: the latest dynamic is clear at a glance

For news updates, industry information, or regularly updated blog content, sorting by publication time is the standard way to ensure users receive the latest information. AnQiCMS articles are always published with aCreatedTimeField record, the system is usually sorted in reverse chronological order (i.e., the most recent one is at the front). AtarchiveListYou can filter through the tags.order="id desc"To implement the latest released articles at the top because usually the article ID increases with the release time.

{# 显示最新发布的10篇文章 #}
{% archiveList archives with type="page" order="id desc" limit="10" %}
    {% for item in archives %}
        <div class="article-item">
            <h3><a href="{{ item.Link }}">{{ item.Title }}</a></h3>
            <p>发布时间: {{ stampToDate(item.CreatedTime, "2006-01-02 15:04") }}</p>
            <p>{{ item.Description }}</p>
        </div>
    {% endfor %}
{% endarchiveList %}

You can also make use of the "timed release" function when publishing articles, preset the future release time, and the system will automatically add it to the latest article list at the specified time. CombinedstampToDateLabel, you can flexibly useCreatedTimeFormatted into any date and time display you need, ensuring that the timeliness of the content is perfectly presented.

Three, Sort by backend custom order: a powerful tool for refined operation

In addition to the automated sorting rules, AnQiCMS also gives you the ability to manually intervene in the order of the article list, which is particularly useful for content recommendation, special topic planning, or highlighting key content.In the article editing interface, there is usually a 'display order' field.You just need to set a priority number for the article in the background, and then use it in the templateorder="sort desc"Parameters, AnQiCMS will display articles strictly in the order you set. IforderLeave the parameter blank, the system will also default to the custom sorting in the background, which means you can manage the display priority of articles in the background without changing the template code.

{# 显示后台自定义排序的前10篇文章 #}
{% archiveList archives with type="page" order="sort desc" limit="10" %}
    {% for item in archives %}
        <div class="article-item">
            <h3><a href="{{ item.Link }}">{{ item.Title }}</a></h3>
            <p>文章概要: {{ item.Description }}</p>
            {# 这里的排序受后台文章编辑界面的“显示顺序”字段控制 #}
        </div>
    {% endfor %}
{% endarchiveList %}

This custom sorting feature gives you absolute control over content presentation, allowing you to prioritize the most important information for users based on operational strategy, whether it's new product launches, important announcements, or featured content, all can receive precise exposure.

Four, combine other filtering conditions to create a more accurate list

Of course, you can combine these sorting methods witharchiveListThe other powerful parameters of the tag combined to create a more targeted list of articles. For example, bycategoryIdspecifying a particular category of articles with parameters, or usingflagParameters to filter content with attributes such as 'Recommended', 'Headline', etc., and then apply the above sorting rules based on this.This combination ability allows you to be more flexible in your content display strategy, accurately meeting the needs of different pages and user groups, thus achieving better operational results.

Related articles

How to filter and display a list of articles based on their recommended attributes (such as “Top Article”, “Recommended”)?

In Anqi CMS, efficient content management is one of the keys to website success.Article recommendation attribute, as an important link in the operation of content refinement, it can help us display website content more flexibly, guide users to pay attention to key information, and thus improve the activity and conversion rate of the website.This article will delve into how to filter and display article lists based on the recommended attributes of articles (such as "Headline

2025-11-08

How to display articles under a specific category without including its subcategories?

In website content management, we often encounter such needs: we want to display articles under a specific category on a page, but we don't want to include the sub-category articles under that category to maintain the purity and focus of the content.For example, you may have a "Company News" category that includes subcategories such as "Enterprise Dynamics" and "Industry Information", but on the homepage, you only want to display the pure "Company News" without mixing in the content of all subcategories.

2025-11-08

How to exclude specific categories or multiple categories of articles from the document list?

When managing website content in Anqi CMS, we often need to precisely control the display of articles.Sometimes, we may want certain category articles not to appear in the regular article list, such as for internal notifications, test content, or some promotional information that is only displayed on specific pages.AnQi CMS provides a simple and efficient method to meet this kind of need, allowing you to flexibly exclude articles of specific categories or multiple categories, thereby achieving more accurate content presentation.

2025-11-08

How to filter and loop through the document list under a specific category based on the category ID?

It is crucial to organize and present content when building and operating a website.Especially when the content of a website becomes increasingly rich, how to enable visitors to quickly find the information they are interested in and clearly browse all articles under a specific theme has become a carefully designed problem.AnQiCMS (AnQiCMS) provides powerful and flexible content management capabilities, allowing us to easily achieve precise control and display of document lists.

2025-11-08

How to obtain and display the title, content, thumbnail, and other core information of an article on the article detail page?

When operating a website, the article detail page is the key entry point for users to understand the core value of the content.A well-designed, comprehensive article detail page that not only improves user experience but also effectively helps search engines understand the content of the page, thus optimizing the website's SEO performance.AnQiCMS (AnQiCMS) provides a powerful and flexible template tag system that allows you to easily obtain and present all the core information of the article.

2025-11-08

How to retrieve the custom fields (such as author, source, additional parameters) of the current article and display them?

In Anqi CMS, managing and displaying custom fields for articles such as authors, sources, or additional parameters is a common and practical need in content operation.The Anqi CMS, with its flexible content model design, provides multiple ways to achieve this goal, helping you easily enrich article information and present it to readers in a personalized manner. ### Understanding AnQi CMS Custom Fields Firstly, we need to understand how article custom fields work in AnQi CMS.

2025-11-08

How to dynamically fetch and display the previous and next articles of the current article on the article detail page?

In website operation, how to allow users to smoothly jump to related or the next article after reading an article is the key to improving user experience and website stickiness.Especially for sites with a large amount of content, such as blogs, information stations, or product display websites, a intuitive 'Previous/Next' navigation function is particularly important.It can not only guide users to deeply browse and reduce the bounce rate, but also provide more internal links for search engines to optimize the SEO performance of the website.AnQiCMS (AnQiCMS) is a powerful content management system that fully considers this need

2025-11-08

How does AnQiCMS define and display related articles? Is it based on keywords or manual association?

In website operation, recommending relevant articles is an important strategy to enhance user experience, extend user stay time, and optimize on-site SEO.AnQiCMS provides a flexible and efficient mechanism to define and display related articles, allowing operators to choose between intelligent recommendations or manual association according to their actual needs. ### Smart Recommendation: Dynamic Association Based on Keywords and Tags The smart recommendation mechanism of AnQiCMS mainly relies on the keywords and tags set in the article content. When you edit articles in the background, you can set: * **Document keywords

2025-11-08