How to effectively highlight key information in content management and website operations to guide users to pay attention to specific articles, which is crucial for improving the effectiveness of the website.AnQiCMS (AnQiCMS) offers a flexible recommendation feature that allows you to easily filter and display articles in article lists or category lists based on attributes such as "Headline" and "Recommended", thus better implementing content operation strategies.
Understanding recommendation attributes: the core tool of content operation
In the Anqi CMS backend, when we publish or edit articles, we will see an option called "recommended attribute".These properties are an important way to classify and tag your articles, they can not only help you organize content, but also achieve differentiation on the front-end page.
- Headline
[h]Indicates that the article has the highest priority, usually used in the most prominent position on the homepage. - Recommended
[c]It indicates that the article is worth recommending to users and can be displayed in various recommendation areas. - Slide
[f]It is usually used in the carousel or slideshow area. - Featured
[a]It is a special recommendation and may have higher weight than ordinary recommendations. - Scrolling
[s]: Suitable for displaying in scrolling news or announcement areas. - Bold
[h]: Mainly used for visual emphasis, making titles stand out in lists (similar to headlines identifier, but usually focused on style). - Image
[p]:Emphasize that the article contains important images, suitable for image display lists. - Jump
[j]:Indicate that the article, when clicked, will jump to an external link or specified page.
By checking these properties, the article is tagged with specific 'tags', laying a foundation for flexible calls on the front-end page.
How to filter and display articles with specific recommended attributes in the article list
To implement the filtering and display of articles, we need to use the powerful template tags of Anqi CMSarchiveList. This tag allows you to get a list of articles based on various conditions (such as model ID, category ID, recommended attributes, etc.)
Suppose you want to display a "Top News" article in a certain area of the website, you can use it like thisarchiveListTags:
{# 筛选并显示所有标记为“头条”的文章 #}
<div class="headline-section">
<h2>最新头条</h2>
{% archiveList headlines with type="list" flag="h" limit="5" order="id desc" %}
{% for item in headlines %}
<div class="headline-item">
<h3><a href="{{item.Link}}">{{item.Title}}</a></h3>
<p>{{item.Description}}</p>
<time>{{stampToDate(item.CreatedTime, "2006-01-02")}}</time>
</div>
{% empty %}
<p>当前暂无头条文章。</p>
{% endfor %}
{% endarchiveList %}
</div>
In this example:
headlinesis a custom variable name used to store the list of articles obtained.type="list"indicate that we hope to obtain a non-paginated list.flag="h"is a core parameter, it tells the system to only filter out articles marked as 'top news'.limit="5"limits the display to 5 articles.order="id desc"Then, list the articles in reverse order by article ID (i.e., the most recently published).
exceptflagParameters, you can also combine other parameters for more refined filtering, such as specifying articles under a specific model or category:
{# 筛选并显示“文章模型”下,“分类ID为10”的“推荐”文章 #}
<div class="recommended-section">
<h2>分类推荐</h2>
{% archiveList recommended_articles with type="list" moduleId="1" categoryId="10" flag="c" limit="4" order="views desc" %}
{% for item in recommended_articles %}
<div class="recommended-article-item">
<img src="{{item.Thumb}}" alt="{{item.Title}}">
<h4><a href="{{item.Link}}">{{item.Title}}</a></h4>
<span>阅读量: {{item.Views}}</span>
</div>
{% empty %}
<p>当前分类暂无推荐文章。</p>
{% endfor %}
{% endarchiveList %}
</div>
Here we have addedmoduleId="1"And assuming the article model ID is 1categoryId="10"To lock the source of the article and useflag="c"Filter articles with the recommendation attribute, sorted by reading volume in reverseorder="views desc"Display.
Apply filtering in the category list or on a specific template page
This method is not only suitable for the homepage or custom page, but also can be flexibly used in category list pages. When you use a category list page (such as{模型table}/list.htmltemplate) when usingarchiveListtags, if omittedcategoryIdparameter,