How does AnQiCMS control the display of content in different areas through the 'Flag' attribute (such as recommended, headline)?

Calendar 👁️ 65

AnQiCMS: Make good use of the "Flag" attribute to accurately control the layout of the website content

In content operation, merely publishing articles is not enough.How to make important content stand out, how to intelligently display specific content in different areas of the website, is the key to improving user experience and operational efficiency.AnQiCMS (AnQiCMS) is well-versed in this, providing us with a powerful and flexible tool - the 'Flag' attribute, to cleverly achieve this goal.

What is the "Flag" attribute of the content?

In simple terms, the "Flag" attribute is like tagging each of your documents with one or more special tags, but these tags are not ordinary categories or keywords.They are predefined, meaningful identifiers used to inform AnQiCMS where this content should appear in special areas of the website.By checking these properties while editing content in the background, we can easily control how content is displayed on the frontend page.

AnQiCMS has built-in 8 commonly used "Flag" attributes, which can be flexibly selected according to the importance of the content, display form, or special purpose:

  • Headline[h]This is usually used in the most prominent position on the homepage, emphasizing news or important announcements.
  • Recommended[c]This indicates that the content has been carefully selected and is worth recommending to users, often used on list pages or sidebars.
  • Slide[f]:Applicable to carousel or image wall, attracting users visually.
  • Featured[a]:A step further than 'recommend', usually referring to valuable or exclusive in-depth content.
  • Scrolling[s]: Suitable for display in news tickers or scrolling bulletin boards to maintain the dynamic visibility of content.
  • Bold[h]This may look similar to the characters of 'Top Story', but in some designs, it may only be used to highlight text, not position. In actual applications, AnQiCMS will[h]Explained as the headline.
  • Image[p]Emphasize content mainly with images, or need special processing of their thumbnail display.
  • Jump[j]: Indicating that the user will be redirected to an external link or another specified page within the site after clicking on this content, rather than the content detail page.

You can check one or more of these properties when publishing or editing documents, AnQiCMS will record them and wait for you to call them in the front-end template.

Set the 'Flag' attribute in the background

The operation to set the "Flag" attribute for content is very intuitive.When you enter the AnQiCMS backend, whether it is 'Add Document' or 'Edit Document', among the many options in the document editing interface, you will see a section named 'Recommended Properties'.

Here, these 8 Flag properties are presented in the form of checkboxes.You can select one or more suitable properties based on the current document's operation strategy.For example, you may check both 'Headline' and 'Recommendation' for a very important press release;And a product that needs to be displayed in a large image carousel will check the 'Slide' attribute.After making a selection, save the document.

Use the 'Flag' attribute in the front-end template to control display

The power of the "Flag" attribute lies in how it seamlessly integrates with AnQiCMS template tags to achieve dynamic content display. The most commonly used tag isarchiveListIt can help us flexibly call different attribute content at any location on the website.

1. Call the content of the specific "Flag" attribute.

If you want to display only the articles marked as 'Top News' in a certain area of the website, such as the 'Top News' section on the homepage, you can use it like thisarchiveListTags:

{# 获取所有被标记为“头条”的文章列表 #}
{% archiveList archives with type="list" flag="h" limit="5" %}
    {% for item in archives %}
        <h3><a href="{{item.Link}}">{{item.Title}}</a></h3>
        <p>{{item.Description}}</p>
    {% endfor %}
{% endarchiveList %}

here,flag="h"Make it clear to AnQiCMS to only crawl those that have been checked for the 'Top' attribute (correspondingh) of the document.limit="5"It limited the display quantity to 5 articles.

Similarly, if you want to display 'Recommended Products', you canflagis set toc:

{# 获取所有被标记为“推荐”的产品列表 #}
{% archiveList recommendedProducts with type="list" moduleId="2" flag="c" limit="4" %}
    {% for item in recommendedProducts %}
        <img src="{{item.Thumb}}" alt="{{item.Title}}" />
        <h4><a href="{{item.Link}}">{{item.Title}}</a></h4>
    {% endfor %}
{% endarchiveList %}

Please note that when you call content in the samearchiveListtag, you can only specify oneflagFilter properties. If you need to display the content of multiple properties at the same time, you need to use differentarchiveListtags to call.

2. Exclude the content of specific "Flag" properties.

Sometimes, we may need to display all the articles under a category, but exclude those that have already been displayed as 'headlines' to avoid repetition. At this time,excludeFlagParameters come into play:

{# 显示分类ID为1的所有文章,但排除掉“头条”文章 #}
{% archiveList normalArticles with type="list" categoryId="1" excludeFlag="h" limit="10" %}
    {% for item in normalArticles %}
        <li><a href="{{item.Link}}">{{item.Title}}</a></li>
    {% endfor %}
{% endarchiveList %}

This ensures that the 'Top News' section and the regular article list will not have the same articles, optimizing the content layout.

3. Display the "Flag" property in list items

In addition to filtering content, you may also want to display the 'Flag' attribute next to each item in the content list, such as adding a 'recommend' word or an icon to 'recommended' articles. This can be done byshowFlagParameters and{{item.Flag}}to achieve:

{# 获取所有文章,并显示它们的Flag属性 #}
{% archiveList allArticles with type="list" showFlag=true limit="8" %}
    {% for item in allArticles %}
        <li>
            {% if item.Flag %}
                <span class="flag-badge">{{item.Flag}}</span> {# 假设item.Flag会返回属性的字母代码,如"h", "c" #}
            {% endif %}
            <a href="{{item.Link}}">{{item.Title}}</a>
        </li>
    {% endfor %}
{% endarchiveList %}

ByshowFlag=true,AnQiCMS will fill the Flag attribute value of the document toitem.Flagwhere you can style or display text based on these letter codes on the front end.

Application scenarios in practice

The "Flag" attribute brings great convenience and flexibility to our content operation:

  • Home focus area: Passflag="f"Call slide content.
  • Sidebar hot recommendations: Passflag="c"Call recommended articles or products.
  • Display of lists in different stylesFor example, on the article list page, you may want to display 'Recommended' articles in large image mode, while other articles are displayed in small image or plain text mode, in which case you can call differentflagApply different styles and content.
  • Avoid confusion in content management.Top content without modifying categories or manually adjusting sorting, just a simple checkbox is needed.

Summary

The "Flag" attribute of AnQiCMS provides a powerful and flexible tool for content operators, allowing content management to go beyond traditional categories and tags.By simply checking the background and calling the front-end template, we can accurately control the display location and style of the website content, greatly enhancing the efficiency of content operation, and also bringing users a higher quality and more guiding browsing experience.Make good use of the "Flag" attribute to make your website content layout more intelligent and efficient.


Frequently Asked Questions (FAQ)

1. Can I call multiple "Flag" properties in a tag at the same time? For example, do I want to display both "Headline" and "Recommend"?archiveList标签中同时调用多个“Flag”属性的内容吗?比如,既想显示“头条”又想显示“推荐”?

No. AnQiCMS'sarchiveListThe tag is inflagThe parameter can specify only one "Flag" property at a time (for exampleflag="h"orflag="c"). If you need to display the content of multiple properties at the same time, you need to use multiple archiveListCall them and then combine them together.

2. What is the difference between the 'Flag' attribute and the ordinary 'Tag tag'?

The "Flag" attribute is a preset of AnQiCMS, mainly used to control the content in specific areas of the website (such as the homepage spotlight, sidebar recommendations, etc.)Display priority and display formThey are system-level content identifiers, usually consisting of a single letter code. The "Tag" label, on the other hand, is created freely by users, focusing more on the content'skeyword summary and associationUsed for topic aggregation and in-site search, it usually generates an independent tag list page.

3. What if I set a 'slide' attribute for a document but the front-end does not call the slide area, what impact will it have?

No negative impact. If you have set a certain "Flag" attribute in the background, but there is no corresponding one in the frontend template.archiveListTo call the content of this attribute, this document is just an internal tag, which will not be specially handled on the front end. It will still be displayed normally in the list under its category, or be displayed by other elements without tagsflagThe parameter'sarchiveListTag calling.

Related articles

How to enable Markdown editor and correctly render mathematical formulas and flowcharts in AnQiCMS?

Enable the complete guide to Markdown, rendering mathematical formulas and flowcharts in AnQiCMS AnQiCMS, as an efficient and flexible content management system, has been striving to provide more convenient and powerful content editing and display capabilities for content creators.For those who often need to write technical documents, academic papers, or explanations involving complex logic processes, the original rich text editor sometimes feels inadequate.

2025-11-08

How to display related article lists in AnQiCMS to enhance user browsing?

In content operations, guiding users to continuously explore within the site, extending their stay time, is one of the key strategies to improve user experience and website conversion rates.The list of relevant articles is an efficient tool to achieve this goal.AnQiCMS as a high-performance, flexible content management system provides various ways to cleverly display related articles, thereby deeply tapping into the browsing potential of users.Why is the related article list so important?

2025-11-08

How to display links to the previous and next articles on the AnQiCMS article detail page?

When visitors browse articles on a website, they often hope to be able to jump to related content conveniently, especially the previous or next one.This design not only improves the user experience, but also has a positive impact on the internal link structure of the website and search engine optimization.AnQiCMS fully considered such user needs, built in simple and efficient template tags, helping us easily implement the previous and next article link function on the article detail page.

2025-11-08

How to display website logo and copyright information in AnQiCMS template?

When building and operating a website, the website's logo and copyright information are an important component of brand image, building user trust, and fulfilling legal statements.For AnQiCMS users, managing and displaying this information is very intuitive and flexible. ### In AnQiCMS backend, set the website logo and copyright information AnQiCMS centralizes the global configuration of the website, allowing you to easily set various basic information.To set the website logo and copyright, you need to go to the 'Global Function Settings' page in the backend.1.

2025-11-08

How to display the publication time of articles in the AnQiCMS template and customize the format?

In website content operation, the publication time of the article is a seemingly simple but crucial detail.It not only affects users' judgment of the timeliness of content, but is also an important reference factor for search engines to evaluate the freshness of content and for ranking.For AnQiCMS users, flexibly displaying and customizing the publication time of articles in templates is a basic operation to improve website user experience and SEO performance.

2025-11-08

How to retrieve and display single-page content in AnQiCMS, such as "About Us"?

In website operation, pages like "About Us" and "Contact Information" are indispensable components. They usually carry relatively fixed and important content such as corporate culture, contact information, and service introduction.For users of AnQiCMS, obtaining and displaying these single-page contents is not only simple and efficient but also highly flexible and customizable.This type of independent page, with content that does not change often, is classified as "single page" by Anqi CMS, and a dedicated management module is provided in the background for easy creation, editing, and publishing by users.

2025-11-08

How to manage and display the list of friend links in AnQiCMS?

Friend links are an important part of website optimization and user experience, they can not only help your website rank better in search engines, but also provide visitors with more valuable resources, and also serve as a bridge to establish contact with industry partners.In AnQiCMS, managing and displaying friend links is a straightforward and flexible operation, allowing you to easily configure these important external connections for your website. ### Back-end Management Friend Links List To start managing friend links, you need to log in to the AnQiCMS back-end.All auxiliary functions are concentrated under the 'Function Management' menu

2025-11-08

How to implement unified management of multi-site content and front-end display in AnQiCMS?

In the current complex and variable network environment, whether it is a large and medium-sized enterprise with multiple sub-brands and business lines, or a self-media operator that needs to create independent content platforms for different audience groups, how to efficiently manage multiple websites and ensure the flexibility and consistency of front-end content display has become a core challenge in content operation.The traditional 'one website, one system' model not only increases the cost of deployment and maintenance, but also makes content collaboration and data analysis extremely complicated.AnQiCMS (AnQi Content Management System) is precisely in such a context

2025-11-08