What is the document Flag attribute?
The document's Flag attribute, also known as recommendation attribute, is a content classification and display mechanism provided by the AnQi CMS.It allows content managers to assign one or more predefined special tags to each document to indicate the importance, display form, or specific position of the content on the website.These properties are identified by letters in the background, which is convenient for precise calling in the frontend template.
The AnQi CMS currently supports the following common Flag attributes:
- Top News
[h]English: Typically used to mark the most important and most concerned news or articles on a website, suitable for displaying in a prominent position with a large amount of text. - [en] Recommended
[c]:indicates that the content has certain recommended value and is suitable for appearance in common recommendation areas, such as sidebar recommendations, article bottom related recommendations, etc. - Slide
[f]This content is commonly used in website carousel or spotlight areas, mainly composed of images, to attract user clicks. - [en]Special Recommendation
[a]:Recommended with higher priority than the general recommendation, suitable for special content or modules that need to be emphasized specially. - Scrolling
[s]:适用于新闻公告、友情链接等需要滚动展示的文本列表。 - Image
[p]:标记为含有图片的文档,方便在纯图片列表或图文混排列表中筛选。 - Jump
[j]:Used to mark documents that, when clicked, will jump to external links or other specific pages within the site.
These Flag properties give you fine-grained control over the way content is displayed, which is an important means to achieve differentiated content operation.
How to set Flag properties during content editing?
In the background management interface of Anqi CMS, setting the document's Flag attribute is very intuitive.When you create or edit a document, you will find the 'Recommended Properties' option on the document details page.Here, all available Flag properties will be listed in the form of checkboxes.
You can select one or more properties based on the actual content of the document and the expected display effect. For example, if you want an article to appear both in the headline area of the homepage and in the normal recommendation module, you can check 'Headline' at the same time.[h]”and” recommendation[c]EnglishIf a content does not require any special marking, keep all checkboxes unchecked.This flexible setting allows you to easily manage the exposure and display of content.
How to filter and display Flag content in the front-end template?
Content is set to Flag attribute, the next step is to filter and display these contents through template tags on the website front-end. The AQ CMS provides powerfularchiveListTag, it is the core to implement Flag content filtering.
PassarchiveListthe tag inflagParameters, you can specify to display documents with a specific Flag attribute. For example, if you want to display all "recommended" content in a module of a website, you can write it like this in the template:
{% archiveList archives with type="list" flag="c" limit="10" %}
{% for item in archives %}
<li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
{% endfor %}
{% endarchiveList %}
This code will retrieve a list of document collections, which only contain documents marked as "recommended", and will display up to 10 documents. It is important to note that when you use[c]"flagParameters are filtered by specifying only one letter identifier of the Flag attribute at a time. If you need to display content with multiple Flag attributes in an area, you must use multiple