How does AnQiCMS filter and display content based on article recommendation attributes (such as headline, recommended)?

Calendar 👁️ 83

In content operation, effectively highlighting and displaying important articles is the key to improving user experience and guiding traffic.AnQiCMS (AnQiCMS) understands this and therefore provides a flexible article recommendation feature that allows you to mark and accurately filter and display content on the website front-end based on its importance or specific use.

Part one: Understanding article recommendation attributes: a tool for content operation

In AnQi CMS, the recommended attributes of articles are like special tags applied to content, which are a powerful mechanism to assist in article classification, aimed at helping you quickly identify and call specific types of articles from a vast amount of content.They are not just marks on the back-end management, but also the foundation of the front-end content presentation logic.

These recommended attributes are crucial for content operation:

  • Enhance the visibility of important content: Mark key articles as 'headlines' or 'slides', ensuring that users can see them as soon as they enter the website.
  • Improve user browsing experience: Display 'recommended' articles or 'scrolling' news based on the user's interests or page layout to enhance the readability and attractiveness of the content.
  • Support diversified content layoutDifferent recommendation attributes can correspond to different display areas, such as the focus image on the homepage, popular recommendations in the sidebar, and bold display on the list page, etc.

Anqi CMS provides a variety of preset recommendation attributes for you to choose from, each attribute corresponds to a short letter code, which is convenient for calling in templates:

  • Headline[h]This is usually used for the most important articles on the website that need immediate attention.
  • Recommended[c]These are regular recommended contents that can be displayed in multiple areas.
  • Slide[f]: Articles applicable to carousel or focus image areas.
  • Featured[a]: Articles specially recommended, importance between headlines and recommendations.
  • Scrolling[s]: Content suitable for news scrolling or notification bulletin boards.
  • Image[p]: Emphasizes that the article contains high-quality images, which may be used in image topics or picture-display areas.
  • Jump[j]The article link will directly jump to an external address, rather than the in-site detail page (usually set during article editing to set the jump link).

In the AnQi CMS backend, when you edit or publish articles, you can find the 'recommended attributes' option in the article editing interface.Here is the multiple choice box, you can select one or more properties according to the actual needs of the article.For example, an article that is both a 'headline' and suitable for a 'slide', you can check both of these options at the same time.

The second part: Precisely calling in the front-end template: Step-by-step implementation of filtering display

To filter and display content on the website front-end based on these recommended properties, Anqi CMS mainly relies on its powerful template tag system, especiallyarchiveListTag. This tag is the core tool for obtaining the list of articles, and through flexible parameter matching, it can realize various content filtering needs.

1. Call articles with specific recommendation attributes.

If you want to display all articles marked as 'recommended' in a certain area (such as the hot recommendations module on the homepage), you can usearchiveListlabel'sflagthe parameter.flagThe value of the parameter is set to the letter code corresponding to the attribute.

Suppose you want to get up to 5 articles marked as 'recommended':

{% archiveList recommendedArticles with type="list" limit="5" flag="c" %}
    {% for article in recommendedArticles %}
        <div class="card">
            <a href="{{ article.Link }}">{{ article.Title }}</a>
            <p>{{ article.Description|truncatechars:100 }}</p>
        </div>
    {% empty %}
        <p>暂无推荐文章。</p>
    {% endfor %}
{% endarchiveList %}

The above code will retrieve up to 5 articles with[c]Recommend articles with properties, and display their titles and summaries in a loop, while linking to the article detail page.

2. At the same time, call articles with multiple recommended properties (OR logic)

In the operation, you may need to display articles that are marked as "headline" or "slideshow", that is, as long as the article has any of these attributes, it should be displayed. At this time, you canflagIn the parameter, use commas to separate multiple property codes.

For example, display 3 articles that are both 'Headline' and 'Slideshow':

{% archiveList importantFeatures with type="list" limit="3" flag="h,f" %}
    {% for item in importantFeatures %}
        <div class="feature-item">
            <h3><a href="{{ item.Link }}">{{ item.Title }}</a></h3>
            <span>属性:{{ item.Flag }}</span> {# 这里显示文章的推荐属性代号 #}
        </div>
    {% empty %}
        <p>暂无重要特色内容。</p>
    {% endfor %}
{% endarchiveList %}

This code will filter out the marked as[h]or[f]of the articles, and display them.

3. Exclude some recommended attributes articles

Sometimes, you may want to exclude certain recommended attributes' articles from a list area, for example, display all articles but exclude those marked as 'Headline' to avoid repetition. In this case, you can useexcludeFlagParameter.

For example, display 5 articles but exclude the "top story" articles:

{% archiveList generalArticles with type="list" limit="5" excludeFlag="h" %}
    {% for article in generalArticles %}
        <div class="article-summary">
            <h4><a href="{{ article.Link }}">{{ article.Title }}</a></h4>
        </div>
    {% empty %}
        <p>暂无普通文章。</p>
    {% endfor %}
{% endarchiveList %}

This way, even if some articles are "top stories", they will not appear in this list.

4. Combine other filtering conditions

Recommended properties do not exist independently, you can combine them witharchiveListother parameters of the tag (such ascategoryIdlimiting specific categories,moduleIdlimiting specific models,ordersorting methods, etc.)

Related articles

How to exclude content of a specific category from the article list?

In website content operation, we often encounter such needs: we hope to display most of the content on the article list page, but articles of certain specific categories are not listed here.For example, you may have a "Company Announcement" category that you only want to display on a separate page, or some articles for internal reference that you do not want to appear in the regular article list facing the public.AnQiCMS (AnQiCMS) provides a very flexible and intuitive way to handle this situation, allowing you to accurately control the display of content on the front end.The Anqi CMS through its powerful template tag system

2025-11-08

How to set the number of articles or products displayed per page in AnQiCMS?

In website operation, especially when managing pages that require a large amount of content display, such as article lists and product display pages, how to efficiently control the number of items displayed per page directly affects user experience and page loading speed.AnQiCMS provides a flexible and powerful mechanism to meet this requirement, it allows you to customize the display of each page according to different page and content types through fine-grained control at the template tag level.The Anqi CMS can provide this flexibility because it closely integrates the display logic of the list content with the template design

2025-11-08

How to display the list of articles by category in AnQiCMS?

It is crucial to organize and display information efficiently in website content management.For users, being able to clearly browse article lists by different categories greatly enhances the access experience and also helps search engines better understand the website structure, thereby optimizing SEO effects.AnQiCMS (AnQiCMS) provides us with flexible and powerful tools, making this requirement easily accessible.

2025-11-08

How does AnQiCMS adapt the display of website content for PC and mobile endpoints?

AnQiCMS: Providing seamless PC and mobile end adaptive display solutions for your website In today's digital age, it is common for users to access websites through various devices, from large computer screens to small smartphones, and the display effect of the website directly affects user experience and the efficiency of information transmission.A website that cannot be displayed friendliness on mobile devices will undoubtedly lose a large number of potential users and business opportunities.AnQiCMS fully understands this requirement and has provided flexible and diverse solutions to ensure that your website content is perfectly presented on both PC and mobile ends

2025-11-08

How to implement pagination functionality for article or product lists in AnQiCMS templates?

How to implement pagination for article or product lists in AnQiCMS template?For any content management system, effectively managing and displaying a large amount of content is a core requirement.When the number of articles or products on a website increases day by day, if there is no reasonable pagination mechanism, users may feel tired while browsing, and the website's loading speed may also be affected.

2025-11-08

How does AnQiCMS allow search results to be paginated on the page?

In AnQiCMS, implementing pagination for the website's search results is an important function for improving user experience and optimizing the website structure.AnQiCMS's powerful template tag system makes this process intuitive and efficient.By reasonably utilizing the `archiveList` and `pagination` core tags, you can easily build a functional search results page.

2025-11-08

How can articles be sorted by views in the AnQiCMS template?

In AnQiCMS, content management is not limited to publishing and organizing, how to effectively display these contents, especially placing popular articles in prominent positions, is the key to improving user experience and website activity.This article will introduce in detail how to sort the article list by views in the AnQiCMS template, making hot content naturally stand out.

2025-11-08

How to display a list of articles published by a specific author in AnQiCMS?

In AnQiCMS, efficiently managing and displaying content is the core of website operation.Sometimes, you may need to display all the articles published by a specific author, such as creating an author column, a team member introduction page, or a personal portfolio.AnQiCMS's powerful template tag system provides a flexible way to meet this requirement, allowing you to easily filter and display a list of content from specific authors.This article will introduce you to how to display a list of articles published by a specific author in AnQiCMS, helping you better organize your website content.##

2025-11-08