In AnQiCMS (AnQiCMS) content management system, effectively organizing and displaying content is the key to enhancing website attractiveness and user experience.Among them, the Flag attribute (recommended attribute) function of the document, as if marking the content with a special 'tag', allows you to flexibly filter and highlight important or specific types of content according to your operational needs.
What is the document Flag attribute?
The document's Flag attribute, also known as the recommendation attribute, is a content classification and display mechanism provided by Anqi CMS.It allows content managers to assign one or more preset special tags to each document to indicate the importance, display format, or specific position of the content on the website.These properties are identified by letters in the background, making it easy to accurately call them in the front-end template.
Safe CMS currently supports the following common Flag attributes:
- Headline
[h]It is commonly used to mark the most important and most concerned news or articles on the website, suitable for displaying in a prominent position in a lengthy manner. - Recommended
[c]: Indicates that the content has certain recommended value, suitable for appearing in ordinary recommendation areas, such as sidebar recommendations, article bottom related recommendations, etc. - Slide
[f]This content is often used in website carousel or focus image areas, mainly with images to attract user clicks. - Featured
[a]:Has higher priority than normal recommendations, suitable for special content or key content modules that need to be emphasized. - Scrolling
[s]: Suitable for text lists that need to be scrolled, such as news announcements and friend links. - Image
[p]: Marked as documents containing images, convenient for filtering in pure image lists or mixed image-text lists. - Jump
[j]: It is usually used to mark documents that will jump to external links or other specific pages within the site when clicked.
These Flag attributes grant you fine-grained control over the way content is displayed, which is an important means of achieving differentiated content operations.
How to set the Flag attribute when editing content?
On the Anqi CMS backend management interface, 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 a checkbox.
You can select one or more properties based on the actual situation of the document and the expected display effect. For example, an article that you want to appear both in the headline area of the home page and in the ordinary recommendation module can select "Headline" at the same time[h]And recommend[c]If some content does not require any special markings, 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?
After setting the Flag attribute, the next step is to filter and display these contents on the website front-end through template tags. Anqicms provides powerfularchiveListThe tag is the core of implementing content filtering for Flag.
ByarchiveListin the labelflagParameters, you can specify to display only documents with specific Flag attributes. For example, if you want to display all 'recommended' content in a module of the 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 that only contain documents marked as \[c]\flagWhen filtering parameters, you can only specify one letter identifier for the Flag attribute at a time. If you need to display the content of multiple Flag attributes in an area, you need to use multiple