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.