In AnQi CMS, efficiently managing and highlighting specific content is the key to the success of website operation.How to ensure that important information can quickly catch the visitor's attention when the content of the website becomes richer, and guide them to browse the core content, has become a problem that every operator needs to think deeply about.flag)Feature, allowing you to easily filter and display specific content in a prominent way, thereby enhancing user experience and the operation of the website.
Understanding the Aanqi CMSflagProperty
flagProperties, as the name implies, are a kind of 'mark' or 'flag' for content, used to identify its special status or purpose. In the Anqi CMS backend, when you publish or edit articles, you can set one or more in the 'Recommended Properties' area for the content.flagThese properties are like tags that are attached to the article, making it convenient for you to classify and aggregate the display on the front-end page.
The AnQi CMS is built-in with a variety of commonly used recommendation attributes, each with its specific letter code and typical application scenarios:
- 【en】Top News
[h]The content is usually used for the most core and important news or articles on the website, often showcased as a single article in the most prominent position on the homepage or channel page. - [en] Recommended
[c]:Suited for high-quality content that is worth recommending to users, which can constitute lists such as 'Hot Recommendations' and 'Featured Articles'. - Slide
[f]: Designed specifically for carousels, articles marked as slides usually contain attractive images and will be displayed in the carousel area on the homepage. - [en]Special Recommendation
[a]:More emphasizes the uniqueness and importance of the content than 'Recommended', suitable for in-depth reporting or special content. - Scrolling
[s]适合在公告栏、news ticker等区域展示,内容通常简短,更新频率高。【en】 - Image
[p]标记那些以图片展示为主的内容,例如图集、product showcase等。【en】 - Jump
[j]If the content of the article itself is an external link or a guide to another page within the site, this property can be used, combined with the URL to achieve a jump after clicking.
These properties can be used individually or in combination, for example, an article can be both a 'headline' and a 'slide', but usually, to keep the page logic clear, we choose the most suitable single one for different display areasflagPerform the call.
How to highlight specific content on the front-end page?
MasteredflagAfter setting the properties, the next step is to use the powerful tag system of Anqi CMS in the website's frontend template to filter and display these marked contents. The core lies in usingarchiveListTags, and through itflagfilter content by parameters.
1. Example of calling news articles
Assuming you want to display a "Headline News" at the top of the website's homepage, it is usually the latest and most important article. You can call it in the template like this:
<div class="section-headline">
{# 调用标记为“头条”的最新一篇文章 #}
{% archiveList headlineArticle with flag="h" limit="1" order="id desc" type="list" %}
{% for item in headlineArticle %}
<a href="{{item.Link}}">
<img src="{{item.Logo}}" alt="{{item.Title}}">
<h2>{{item.Title}}</h2>
<p>{{item.Description|truncatechars:100}}</p>
</a>
{% empty %}
<p>暂无头条文章。</p>
{% endfor %}
{% endarchiveList %}
</div>
In this example:
flag="h":Specify to only fetch articles marked as 'Top News'.limit="1":Limit to displaying only one article.order="id desc":Sort by article ID in descending order, i.e., to fetch the latest Top News articles.item.Logo【en】:If the cover image is set for the article, it will be displayed here.item.Description|truncatechars:100【en】:Displays the article's introduction and truncates to the first 100 characters.
【en】:2. Example of calling the popular recommendations list.
At the side栏 or bottom of the content page of a website, there is often a "Hot Recommendations" list, attracting users to continue browsing other high-quality content.
<div class="sidebar-recommendations">
<h3>热门推荐</h3>
<ul>
{# 调用标记为“推荐”的5篇文章,并按浏览量倒序排列 #}
{% archiveList recommendedArticles with flag="c" limit="5" order="views desc" type="list" %}
{% for item in recommendedArticles %}
<li><a href="{{item.Link}}">{{item.Title}}</a></li>
{% empty %}
<li>暂无推荐文章。</li>
{% endfor %}
{% endarchiveList %}
</ul>
</div>
Here we usedflag="c"to filter recommended content and throughorder="views desc"Let the articles with the highest view count be ranked at the top.
3. Example of calling a slide (carousel))
For the visual focus of the website homepage — the slide area,flag="f"the properties become particularly important.
<div class="main-carousel">
<div class="carousel-inner">
{# 调用标记为“幻灯”的3篇文章,通常这些文章会配有高质量大图 #}
{% archiveList carouselSlides with flag="f" limit="3" type="list" %}
{% for item in carouselSlides %}
<div class="carousel-item">
<a href="{{item.Link}}">
<img src="{{item.Logo}}" alt="{{item.Title}}">
<div class="carousel-caption">
<h4>{{item.Title}}</h4>
</div>
</a>
</div>
{% empty %}
<p>暂无幻灯片内容。</p>
{% endfor %}
{% endarchiveList %}
</div>
{# 这里通常会配合JavaScript和CSS库实现轮播功能,AnQiCMS标签只负责内容输出 #}
</div>
In this scenario,item.LogoUsed to display the large image,item.TitleAs a slide title or description.Please note that the actual dynamic effects of the slides usually require the support of frontend JavaScript and CSS libraries, and the Anqi CMS tags are mainly responsible for providing the data source.
4. Implement more refined filtering by combining other parameters
flagThe property does not exist in isolation, it can be associated withmoduleId(Content Model ID),categoryId(Category ID),order(sort method),limitCombining parameters such as "display quantity" to achieve more accurate content filtering.
For example, if you want to display "recommended" articles under a specific category:
{# 在文章模型ID为1,分类ID为10的分类下,显示3篇推荐文章 #}
{% archiveList categoryRecommended with moduleId="1" categoryId="10" flag="c" limit="3" type="list" %}
{# ... 循环显示文章内容 ... #}
{% endarchiveList %}
Content operation strategy and **practice
Make full use offlagProperties, not only technical operations, but also a kind of wisdom in content operation.
- Clear
flagDefinition and Usage:Establish consensus within the team, each kind offlagWhat type of priority content should be represented, where it should be displayed, and avoid random marking to prevent confusion. - Maintain scarcity and avoid abuse:The core content stands out because it is limited in quantity. If all articles are marked as 'Recommended' or 'Headline', these attributes lose their guiding function. Allocate reasonably
flag, so that