How to use the recommendation attribute (Flag) of AnQi CMS to display featured content on the homepage or special page?

Calendar 👁️ 65

AnQi CMS provides an efficient way to manage and highlight important content on your website, that is, through the "recommended attribute" (Flag).This feature allows you to easily display carefully selected content on the homepage, special pages, or other key locations, thereby guiding visitors' attention and enhancing the interactivity and information delivery efficiency of the website.

Background setting of recommended attributes: the first step of content selection

In the AnQi CMS backend, the starting point for managing content is to publish or edit documents.When you are ready with high-quality content, and hope it can stand out in the key position of the website, the recommendation attribute comes into play.

You can find the "recommended properties" item on the document editing page. Anqi CMS provides a variety of preset recommended properties, each corresponding to a specific letter identifier for easy use in front-end templates:

  • Headline [h]This is usually used to display the most important and most concerned content, such as the headline news on the homepage of a website.
  • Recommend [c]This is widely used in recommended content areas, such as "Editor's Recommendation", "Featured Articles", and so on.
  • Slide [f]: Suitable for use in carousel or slideshow presentations, with strong visual appeal.
  • Special recommendation [a]: Indicates a special recommendation, with importance between headlines and ordinary recommendations.
  • Scroll [s]This is suitable for news scrollbars or bulletin boards, displaying multiple brief messages quickly.
  • Image [p]This indicates a document with high-quality images, which can be used for image galleries or recommended image positions.
  • Jump [j]If the document link needs to jump to an external page or another specified page within the site, this attribute can be marked.

You can select one or more recommended attributes for a document based on the importance of the content or display requirements.For example, an article that is both a headline and has beautiful pictures can check both This flexible setting lays a solid foundation for the refined operation of content.

Front-end template calling and display: Let the selected content 'shine'.

After setting up the recommended attributes in the background, the next step is to display the content with specific attributes on the front page of the website through template tags. The Anqi CMS template system providesarchiveListThe tag is the core to achieve this goal.

archiveListThe tag allows you to filter and retrieve document lists based on various conditions, including the wordflagThe parameter is used specifically to call documents with specific recommendation attributes.

Here are several common calling scenarios and code examples:

  1. Displaying "Top Stories" on the homepage:Assuming you want to display the top 5 most important "headlines" articles at the top of the website homepage, and that these articles all belong to the "article" content model (moduleId="1")

    {# 在首页展示头条文章 #}
    <div class="homepage-headlines">
        <h2>今日头条</h2>
        <ul>
            {% archiveList headlines with moduleId="1" flag="h" limit="5" %}
                {% for item in headlines %}
                    <li>
                        <a href="{{ item.Link }}" title="{{ item.Title }}">
                            <h3>{{ item.Title }}</h3>
                            {# 如果头条文章有缩略图,也可以在这里显示 #}
                            {% if item.Thumb %}<img src="{{ item.Thumb }}" alt="{{ item.Title }}">{% endif %}
                        </a>
                    </li>
                {% empty %}
                    <li>暂无头条文章。</li>
                {% endarchiveList %}
            </ul>
        </div>
    

    In the above code,flag="h"Filter out the content marked as 'Top News' precisely,limit="5"which controls the number of displayed items.

  2. Display the 'Recommended' content under a specific category on the special page:If you want to display specific categories (such as the "Product Case" category) of a certain topic page (for example) and recommend products under it, and include images.categoryId="10")}

    {# 在某个专题页展示特定分类下的推荐产品 #}
    <div class="special-page-featured">
        <h3>精选案例推荐</h3>
        <div class="product-grid">
            {% archiveList featuredProducts with moduleId="2" categoryId="10" flag="c" limit="8" %}
                {% for item in featuredProducts %}
                    <div class="product-item">
                        <a href="{{ item.Link }}" title="{{ item.Title }}">
                            {% if item.Thumb %}<img src="{{ item.Thumb }}" alt="{{ item.Title }}">{% endif %}
                            <h4>{{ item.Title }}</h4>
                            <p>{{ item.Description|truncatechars:50 }}</p> {# 截取50个字符作为简介 #}
                        </a>
                    </div>
                {% empty %}
                    <p>暂无精选案例推荐。</p>
                {% endarchiveList %}
            </div>
        </div>
    

    In this example, we combinemoduleId(Product Model),categoryId(specified category) andflag="c"(recommendation), precisely filtering out the target content.item.Thumbanditem.DescriptionVariables are used to display the thumbnail and brief introduction of the content.

archiveListThe flexibility of tags:

exceptflag/moduleId/categoryIdandlimitIn addition to these common parameters,archiveListit also supportsorder(Sorting method, such as by publication time)id descor viewsviews desc)、excludeFlag(Exclude specific attribute content) parameters, allowing you to more finely control the display logic of the content.By reasonably using these parameters, you can flexibly build various content display modules according to the actual needs of the website.

The practical application and effect

Utilizing recommendation attributes to organize content can bring various operational advantages:

  • Improve user experience:Visitors can quickly find the most important, most popular, or most relevant information on the website, reducing the time spent on information filtering.
  • Enhance content exposure:Place the core content in prominent positions such as the home slide, headline recommendations, etc., which greatly increases the chance of being clicked and read.
  • Optimize content distribution:For different pages (such as the home page, category page, special page) set different recommendation logic to achieve precise content distribution and meet the diverse needs of visitors.
  • Supports marketing activities:Cooperate with the launch of new products, promotional activities, etc., mark relevant content as recommended, and quickly promote it.

The recommended attribute feature of Anqi CMS, with simple operation, seamlessly connects with template tags, and is a powerful tool for you to carry out content refinement operation and enhance the value of the website.


Frequently Asked Questions (FAQ)

  1. Ask: Can a document set multiple recommended attributes at the same time? Answer:Yes, a document can select multiple recommended properties at the same time according to actual needs.For example, a popular headline news can be checked both as 'Headline[h]' and 'Recommended[c]'.

  2. Ask: How do I display the content of both 'Recommended' and 'Slideshow' attributes in the same area? Answer:You can use two separatelyarchiveListtags to call. For example, use one firstarchiveListInvokeflag="c"and then the otherarchiveListInvokeflag="f"The content. According to the template design, you can place them in adjacent areas, or integrate them through some front-end technologies (such as JS carousel) to display them.

  3. **Ask: The order of recommended properties affects the front-end content.

Related articles

How does Anqi CMS implement seamless language switching and display of multilingual content on the front-end page?

Today, with the deepening of globalization, website content that can reach users of different languages has become a key factor in enterprises expanding the market and enhancing brand influence.AnQiCMS (AnQiCMS) is well aware of this need, and from the very beginning of system design, it has made multilingual support one of its core features, aiming to help users easily switch and display content seamlessly on the front-end page.How does Anqi CMS help us build and manage multilingual websites and allow visitors to switch between different language versions smoothly?

2025-11-08

How to accurately retrieve and display a specific article list based on category ID?

In a content management system, effectively organizing and displaying content is crucial for improving user experience and website SEO performance.AnQi CMS with its flexible and powerful template engine allows you to easily implement the requirement of fetching and displaying a list of articles based on a specific category ID.Whether it is to build a special page, category archive, or simply to display the latest content of a specific column on the homepage, Anqi CMS can provide intuitive and efficient solutions.This article will deeply explore how to utilize the template tag feature of Anqi CMS, especially the `archiveList` tag, to accurately achieve this goal

2025-11-08

How to customize the display layout and elements of the AnQi CMS article detail page?

In AnQi CMS, managing and displaying content is a core function, and the article detail page, as an important interface for users to obtain information and interact with the website, is directly affected by the display layout and design of the elements, which in turn affects user experience and information communication efficiency.AnQi CMS provides high flexibility, allowing users to deeply customize the display of article detail pages according to their own needs. To customize the article detail page, you first need to understand the Anqi CMS template system.It uses syntax similar to the Django template engine, template files are usually suffixed with .html

2025-11-08

How to flexibly configure the display of "Built-in links", "Category page links", and "External links" in the website navigation?

Website navigation, just like a map for users to explore your website, a clear and efficient navigation can greatly enhance the user experience and help visitors quickly find the information they need.In AnQiCMS, the website navigation configuration provides very high flexibility, allowing you to combine 'built-in links', 'category page links', and 'external links' ingeniously according to your actual needs, and make fine-grained settings. ### Diverse navigation location and hierarchy management In AnQiCMS, you do not have to stick to a fixed navigation menu.You can access the 'Navigation Category Management' feature

2025-11-08

How to customize the content model field and flexibly call it to display its content in the template?

AnQiCMS is one of the core strengths in content management, with its flexible and customizable content model.This allows us to no longer be limited by a fixed content structure, enabling us to create personalized content types that meet the actual operational needs of the website.No matter if you are publishing technical articles, showcasing product details, or managing event information, custom content model fields can help you accurately construct the content structure you need and ultimately flexibly display it on the website front end.

2025-11-08

How to set up an independent template for the single page of AnQi CMS to achieve highly personalized display?

In website operation, we often encounter such needs: some single pages, such as 'About Us', 'Contact Information', or 'Product Download' pages, need to have unique layouts and functions to provide a more unique user experience or carry specific marketing goals.AnQi CMS understands the importance of personalized display and therefore provides a very flexible way for us to tailor exclusive templates for each single page, achieving highly personalized display effects.

2025-11-08

How to control the automatic lazy loading of images in the article content of AnQi CMS

In website operation, page loading speed and user experience are crucial aspects.Especially for articles that contain a large number of images, the loading of images often becomes the 'culprit' that slows down the page speed.At this time, the image lazy loading (Lazy Loading) technology is particularly critical.AnQi CMS deeply understands this, providing a simple and efficient way to control the automatic lazy loading of images in article content, helping your website to improve performance and user experience.Why is lazy loading of images so important? Lazy loading of images is a strategy of deferred loading

2025-11-08

How to display website name and Logo in AnQiCMS?

The website's name and logo are like the face of a brand, they are not only the first impression visitors have of you, but also an important manifestation of the website's professionalism and recognition.In AnQi CMS, setting and displaying your website name and logo is a straightforward and efficient process.Next, we will explore how to perfectly present these key elements on your website. ### First, set up the website name and Logo To make your website have a unique name and Logo, the first step is to configure it in the Anqi CMS backend management interface.1. **Enter Global Settings**

2025-11-08