How to use the article's `flag` attribute (such as 'Top Story', 'Recommendation') to filter and highlight specific content?

Calendar 👁️ 61

In AnQi CMS, effectively managing and highlighting specific content is the key to successful website operation.When the content of a website becomes richer, how to ensure that important information can quickly attract the attention of visitors, guide them to browse the core content, and this has become a problem that every operator needs to think deeply about.AanQi CMS provides powerful "recommended attributes" (')flagFunction that allows you to easily filter and display specific content in a prominent way, thereby enhancing user experience and the operation of the website.

Understand AnQi CMS.flagproperty

flagAttribute, as the name implies, is a kind of "marker" or "flag" of 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 recommended attributes for the content in the "Recommended Attributes" areaflagThese properties are like tags applied to articles, making it easy to classify and aggregate display on the frontend page.

AnQi CMS has built-in a variety of commonly used recommendation attributes, each with specific letter codes and typical application scenarios:

  • Headline[h]It is usually used for the most core and important news or articles on a website, often displayed as a single article in a prominent position on the homepage or channel page.
  • Recommended[c]: Suitable for high-quality content that is worth recommending to users, which can constitute lists such as "Hot Recommendations", "Featured Articles", etc.
  • Slide[f]: Designed for carousels, articles marked as slides usually contain attractive images and are displayed in the carousel area on the homepage.
  • Featured[a]:Compared to 'recommended', it emphasizes the uniqueness and importance of the content, and can be used for in-depth reports or special features.
  • Scrolling[s]: Suitable for display in bulletin boards, news ticker areas, etc., content is usually short and updated frequently.
  • Image[p]: Mark those contents that are mainly presented with images, such as albums, product displays, etc.
  • Jump[j]If the content of the article itself is an external link or a guide to another page within the site, this attribute can be used in conjunction with the URL to achieve a click-through.

These properties can be used individually, or combined, for example, an article can be both a 'headline' and a 'slide', but usually we choose the most appropriate single one for different display areasflagMake a call.

How to highlight specific content on the frontend page?

MasteredflagAfter setting the properties, the next step is to use the powerful tag system of the Anqí CMS in the front-end template of the website to filter and display the content marked. The core is to usearchiveListTag, and through itflagFilter content by parameters

1. Call the headline article example

Suppose you want to display a 'Top News' article at the top of the website homepage, which 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 only to retrieve articles marked as 'Headline.'
  • limit="1": Limit to display only one article.
  • order="id desc": Sort by article ID in descending order, i.e., to get the latest headline article.
  • item.LogoIf the article is set with a cover image, it will be displayed here.
  • item.Description|truncatechars:100Display the article introduction and truncate to the first 100 characters.

2. Call the example of the popular recommendation list.

On the sidebar or at the bottom of content pages on 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>

We used hereflag="c"To filter recommended content and throughorder="views desc"Articles with the highest number of views should be displayed at the top.

3. Example of calling the slide (carousel) example

For the visual focus of the home page - the slide area,flag="f"The attribute is 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 large images,item.TitleAs a slide title or description. Please note that the actual dynamic effects of the slide usually require support from front-end JavaScript and CSS libraries, and the Anqi CMS tag is mainly responsible for providing data sources.

4. Fine-tune the selection with other parameters

flagThe attribute does not exist in isolation, it can bemoduleId(Content Model ID),categoryId(Category ID),order(Sorting method),limit(Display quantity) combined with other parameters to achieve more accurate content filtering.

For example, do you want to display the "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 content operation wisdom.

  1. clearflagDefinition and Usage:Establish consensus within the team, each kind offlagRepresents what type of priority content should be displayed, and avoid random marking to cause confusion.
  2. Maintain scarcity and avoid abuse:The core content is striking because it is limited in quantity. If all articles are marked as 'recommended' or 'headline', these attributes lose their guiding role. Allocate reasonablyflag, to make

Related articles

How to obtain and display the contact information configured on the back-end, such as phone numbers, email addresses, WeChat QR codes, and other diversified information?

AnQiCMS (AnQiCMS) is an efficient and flexible content management system that excels in helping enterprises display their brand image and provide convenient communication channels.For any website, having clear and easily accessible contact information is crucial for building trust with users and promoting cooperation.AnQi CMS deeply understands this, providing a set of intuitive and powerful functions that allow you to easily manage and display various contact information such as phone numbers, email addresses, WeChat QR codes, etc.### Backend Configuration: Central Management Center for Contact Information In AnQi CMS

2025-11-08

How to retrieve and display the global settings information of a website, such as the website name, Logo, and filing number in the template?

When building website templates in AnQiCMS, we often need to display some general information at the website level, such as the name of the website, Logo image, and legal filing number required by law.This information is usually managed in the background global settings to ensure consistency across the entire site and ease of maintenance.AnQiCMS has a powerful template tag system, especially the `system` tag, which makes it very intuitive and efficient to obtain and display these global settings in the template.### Understanding Global Settings and `system`

2025-11-08

On the article detail page, how to obtain and display a list of recommended articles related to the current article?

In website content operation, improving user stay time and reducing bounce rate is the goal pursued by every operator.After a user reads an article, if they can immediately see other content that interests them, it will undoubtedly greatly enhance their engagement, thereby improving the overall interactivity and user experience of the website.While AnQiCMS (AnQiCMS) is a powerful content management system, it provides us with convenient tools to implement intelligent recommendations for article detail pages without complex development work.The list of recommended articles not only provides users with a deeper reading experience, but also guides them to browse more website content

2025-11-08

How to control the article list to only display documents under the current category and not include content from its subcategories?

When managing website content in Anqi CMS, we usually organize articles into different categories to form a clear hierarchical structure.This structure provides great convenience when managing content in the background.However, when displaying the list of articles on the front-end page, we sometimes need to control the display range of content more accurately, for example, we only want to display the articles directly published under the current category, and not include the content of its subcategories.Luckyly, AnQi CMS provides a simple and powerful solution for this: using the `archiveList` template tag's `child`

2025-11-08

How to receive and display custom form fields from the backend in a frontend comment form?

In website operation, the message form is an important channel for interacting with users, collecting feedback and leads.AnQiCMS provides flexible comment functions, one very practical ability is to allow us to customize form fields in the background, and seamlessly present them in the front-end comment form to meet the personalized information collection needs of different business scenarios.Next, we will discuss in detail how to implement this feature in Anqi CMS.### One, define the custom message field in the background First, we need to enter the Anqi CMS backend management interface

2025-11-08

How to format an article's publish timestamp into a user-friendly date and time format, such as '2023 January 01 14:30'?

User-friendly date and time display is crucial for website content.A clear and readable time format not only improves the visitor's reading experience, but also helps them quickly understand the publishing or updating timeliness of the content.In AnQiCMS, formatting the publication timestamp of articles into a format such as '2023-01-01 14:30' is both flexible and efficient.Understanding the use of timestamps in AnQiCMS In the content managed by AnQiCMS, whether it is articles, products, or other custom models

2025-11-08

How to display a dynamic banner image on the homepage of a website and implement click-through?

Displaying dynamic banner images with click-through functionality on the website homepage is a common need to enhance the visual appeal and user interaction of the site.By utilizing the powerful functions and flexible template mechanism of AnQiCMS, we can easily achieve this goal.The entire process is mainly divided into two parts: background configuration and front-end template invocation. ### First Step: Configure Banner Image and Link To display a dynamic rotating Banner on the website homepage, you first need to upload the image and set the link in the AnQiCMS backend. Typically

2025-11-08

How can AnQi CMS achieve automatic image compression and conversion to WebP format to optimize page loading performance?

Website images are important elements to enhance the attractiveness of content, but if not handled properly, they may also become the 'culprits' that slow down the website loading speed.For website operators, optimizing image loading performance can not only improve user experience but also have a positive impact on search engine rankings (SEO).AnQi CMS is an efficient content management system that fully considers this point, providing users with convenient and powerful image optimization features, especially automatic compression and WebP format conversion, allowing the website to maintain image quality while having faster loading speed.###

2025-11-08