How to configure the recommended attributes of articles (such as headlines, sliders) in AnQiCMS and display them in different areas on the front end?

Calendar 👁️ 69

Manage website content in Anqi CMS and make important information stand out to users, which is the key to improving user experience and content marketing effectiveness.Among them, the configuration of the recommended attributes of the article and the front-end display are important functions to achieve this goal.By setting it up reasonably, you can easily display articles like "Headlines" and "Slides" in different positions on the website to attract visitors' attention.

The first part: Set the recommendation attributes for the article in the background

Firstly, we need to enter the Anqi CMS backend management interface to assign the 'recommendation attributes' to specific articles.

You can find "Content Management" in the left navigation bar, then select "Publish Document" or "Document Management" to edit existing articles.After entering the article editing page, you will see a series of setting options.There is a section named "recommended attribute".

AnQi CMS provides eight preset recommended attributes, each attribute is identified by a letter code, which is convenient for you to call accurately in the front-end template:

  • Headline [h]: Typically used in the most prominent position on a website, such as the top header article on the homepage.
  • Recommend [c]: Suitable for regular recommendation positions, such as sidebars, recommended articles in lists.
  • Slide [f]: Designed specifically for carousels, suitable for displaying as image slides on the homepage or specific pages.
  • Special recommendation [a]: Indicates a special recommendation, with importance between headlines and ordinary recommendations.
  • Scroll [s]: Suitable for news tickers or bulletin boards, content will be displayed in a scrolling manner.
  • Bold [b]: The article title will be displayed in bold style in the list, emphasizing the content.
  • Image [p]: Indicates that the article contains important images that may require special display styles.
  • Jump [j]If clicking on an article needs to jump to an external link instead of the article detail page, this attribute can be used.

When setting recommended attributes for an article, you can select one or more attributes based on the importance of the article and its suitable display method.For example, an extremely important article, you may want it to be displayed on the homepage in a slide show format, and also appear as a recommended article in other places. In this case, you can check both 'Slide [f]' and 'Recommended [c]'.After selecting, don't forget to save the article, so the recommended properties take effect.

Part two: Call and display recommended articles in the front-end template.

Next, we will learn how to call and display articles in the website's front-end template based on these recommended properties.The AnQi CMS template tag system makes this process very intuitive.We mainly usearchiveListTag to get the list of articles and throughflagParameter to specify the recommended attribute to be called.

You need to edit the template files of the website, which are usually located/templateIn the directory of the theme folder you are currently using. If you are not sure how to edit the template, you can first try online editing in the "Template Design" feature on the back end, or consult the help documents related to "Template Creation".

Here are some common scenarios and code examples of recommended articles displayed in different front-end areas:

1. Display the "headline" article at the top of the homepage

The headline area on the homepage usually only has one article, which requires prominence. You can call the article that is set with the "headline [h]" attribute like this:

{# 假设这是你的首页模板文件,例如 index/index.html #}
<div class="main-headline">
    {% archiveList headlines with type="list" flag="h" limit="1" order="id desc" %}
        {% for item in headlines %}
        <a href="{{ item.Link }}" class="headline-link">
            <img src="{{ item.Logo }}" alt="{{ item.Title }}" class="headline-image">
            <h1 class="headline-title">{{ item.Title }}</h1>
            <p class="headline-description">{{ item.Description }}</p>
        </a>
        {% empty %}
        <p>暂无头条文章。</p>
        {% endfor %}
    {% endarchiveList %}
</div>

Here, we useflag="h"To specify the headline article,limit="1"Limit to displaying only one article,order="id desc"ensuring that the latest published headline article is displayed.item.Logowill automatically obtain the cover thumbnail of the article.

2. Display "slide" articles in the slide area.

The carousel area of the website often needs to display multiple articles in a picture with title form in a loop. For articles that have set the "slide [f]" attribute, you can call it like this:

{# 幻灯片区域的HTML结构,通常会配合JavaScript轮播库使用 #}
<div class="carousel-container">
    <div class="swiper-wrapper">
        {% archiveList slides with type="list" flag="f" limit="5" order="sort desc" %}
            {% for item in slides %}
            <div class="swiper-slide">
                <a href="{{ item.Link }}">
                    <img src="{{ item.Thumb }}" alt="{{ item.Title }}" class="slide-image">
                    <div class="slide-caption">
                        <h3>{{ item.Title }}</h3>
                    </div>
                </a>
            </div>
            {% empty %}
            <p>暂无幻灯片文章。</p>
            {% endfor %}
        {% endarchiveList %}
    </div>
    {# 其他轮播导航/分页器元素 #}
</div>

Here, flag="f"Filter out slide articles,limit="5"Get up to five articles,order="sort desc"It will display according to the article sorting priority you set in the background.item.ThumbIt will automatically retrieve the article thumbnail.

3. Display 'Recommended' articles in the sidebar

The sidebar is usually used to display some popular or featured articles. Articles with 'Recommended [c]' set are ideal choices:

{# 侧边栏推荐模块 #}
<div class="sidebar-module recommended-articles">
    <h2>推荐阅读</h2>
    <ul>
        {% archiveList recommended with type="list" flag="c" limit="10" order="views desc" %}
            {% for item in recommended %}
            <li>
                <a href="{{ item.Link }}">{{ item.Title }}</a>
                <span>({{ item.Views }} 阅读)</span>
            </li>
            {% empty %}
            <li>暂无推荐文章。</li>
            {% endfor %}
        {% endarchiveList %}
    </ul>
</div>

Here we useflag="c"Get recommended articles,limit="10"Display ten articles, andorder="views desc"Making the articles with the highest views displayed first, which is very suitable for the “Hot Recommendations” scenario.

4. Bold the title of a specific article in the article list

If you want some important articles to stand out in a regular article list, you can use the "bold [b]" attribute. However, it is important to note that,flagThe parameter is inarchiveListYou can only specify one attribute at a time. If you want tothe sameDisplay all articles in the list and make the article titles with the "bold" attribute bold, you cannot directly inarchiveListuse it inflag="b"Filter it (because it will only display bold articles).

A more flexible approach is to first get the list of articles, then in the loop, determine whether each article has the "bold" attribute. This requiresshowFlag=trueParameters to letitem.FlagField available:

{# 常规文章列表,同时加粗显示特殊文章 #}
<ul class="article-list">
    {% archiveList articles with type="page" limit="15" showFlag=true %}
        {% for item in articles %}
        <li>
            {# item.Flag 是一个字符串,包含所有设置的flag字母,例如 "hc" #}
            <a href="{{ item.Link }}" class="{% if item.Flag|contain:"b" %}font-bold{% endif %}">
                {{ item.Title }}
            </a>
            <span> - {{ stampToDate(item.CreatedTime, "2006-01-02") }}</span>
        </li>
        {% empty %}
        <li>暂无文章。</li>
        {% endfor %}
    {% endarchiveList %}
</ul>

In this example,showFlag=trueEnablesitem.FlagField contains all recommended attributes of the article (such as “hc”). We usecontainjudge.item.FlagWhether it contains the letter “b”, if it does, then add the link tofont-boldClass, to implement bold effect.

Some general parameter prompts:

  • moduleIdIf you have multiple content models (such as articles, products),

Related articles

How to call the website logo, filing number, and copyright information to display in the footer in AnQiCMS template?

In website operation, the footer usually carries important content such as brand logo, legal statements, filing information, and copyright statements.This information not only concerns the professional image of the website, but also reflects trustworthiness and compliance.For those who use AnQiCMS, flexibly calling this information in templates to achieve dynamic updates is a basic and practical skill.AnQiCMS is renowned for its concise and efficient architecture and the high performance brought by the Go language. It provides an intuitive template tag system, making it very easy to display website content.

2025-11-08

How to add watermarks and anti-capture interference codes to the images in AnQiCMS article content to protect originality?

Today, with the increasingly rich digital content, the value of original content becomes more prominent, but it also faces the risk of being misused and plagiarized.Especially well-crafted images and written articles often become targets for criminals, not only violating the creators' labor成果, but also potentially diluting brand influence.Fortunately, AnQiCMS is a management system that focuses on user experience and content security, built-in powerful image watermarking and anti-crawling interference code functions, aimed at helping you easily protect your digital assets.###

2025-11-08

How is the multilingual function of AnQiCMS implemented in the front-end for content switching and display?

Today, with the increasing integration of globalization, providing multilingual content on websites has almost become a standard feature to reach a wider audience.For small and medium-sized enterprises and content operations teams, how to efficiently and flexibly implement the switching and display of multilingual content is a key factor to consider when choosing a content management system.AnQiCMS is a system developed based on the Go language, which provides a clear and practical solution in this regard.

2025-11-08

How to enable Markdown editor in AnQiCMS and display mathematical formulas and flow charts correctly?

In AnQiCMS, content creation can not only rely on the traditional rich text editor, but the new version also introduces a Markdown editor, providing great convenience for users accustomed to Markdown syntax.Markdown is known for its concise and efficient features, making content writing more focused and quick.It is even more pleasing that with some simple configurations, we can also elegantly display complex mathematical formulas and intuitive flowcharts on the website.

2025-11-08

How to implement scheduled article publishing in AnQiCMS to ensure content is displayed to users as planned?

## Content publishing no longer chaotic: AnQiCMS's scheduling feature helps you easily plan your content schedule In the fast-paced digital content world, maintaining the rhythm of content publishing is crucial.Whether it is a small and medium-sized enterprise, a self-media operator, or a multi-site manager, everyone knows that presenting content to users according to a plan can effectively enhance brand image and increase user stickiness.However, manual publishing is not only time-consuming and labor-intensive, but it is also easy to disrupt the established plan due to various unexpected situations.AnQiCMS is well-versed in this, and its built-in scheduled publishing function is exactly designed to solve these pain points

2025-11-08

How to use the AnQiCMS custom field feature to add additional display parameters to the product detail page?

In a content management system, the product detail page often needs to display more rich and specific product parameters than basic information to meet the personalized needs of different industries and products.AnQiCMS provides a powerful custom field feature, allowing us to easily add these additional display parameters to the product detail page without modifying the core code.The next step is to detail the three-step process of using AnQiCMS custom fields to inject more vitality into your product detail page.

2025-11-08

How to build a multi-level menu and display it on the front end using the AnQiCMS navigation list tag (`navList`)?

The navigation system of the website is the core bridge for users to interact with content, especially for sites with rich content or deep levels, a clear and efficient multi-level menu is crucial.AnQiCMS provides a powerful and flexible navigation list tag (`navList`), allowing you to easily build and display a fully functional multi-level menu.To make full use of the navigation function of AnQiCMS, we need to start from the background configuration and then proceed to the rendering of the front-end template, step by step building the menu structure we desire.### One, Back-end Navigation Configuration

2025-11-08

How to set the SEO title, keywords, and description for a single page in AnQiCMS, and customize its template?

Managing website content in AnQiCMS, a single page (or independent page) is a very practical feature, such as common pages like "About Us", "Contact Information", and so on.These pages' content is relatively fixed, but its SEO performance and display form are crucial for the overall image and user experience of the website.AnQiCMS is designed with SEO-friendliness in mind and provides flexible template customization capabilities, allowing us to easily set up unique SEO information and customize the display templates for each single page.

2025-11-08