How to add recommended attributes to articles, products, and display them in front-end categories?

How to effectively highlight important information in content operation, so that users can find the core content at a glance, which is the key to improving the effectiveness of the website.AnQiCMS (AnQiCMS) provides a flexible recommendation feature that allows you to easily mark the importance of articles, products, or other content and display them on the website as needed.This article will introduce in detail how to add these recommended attributes to content in the background, as well as how to classify and display them in the front-end template.


Use the Anqi CMS recommendation attribute to make your content shine on the front page

On content management and presentation, AnQiCMS has provided us with many conveniences.Among them, the "recommended feature" is particularly useful, as it helps us effectively tag and prioritize a massive amount of content, ensuring that the most valuable information can be discovered by users in a timely manner.Whether it is to promote a重磅 article to the homepage headline or to make a popular product stand out on a specific category page, recommendation attributes are efficient tools to achieve these goals.

1. Add recommendation attributes for content in the background

Setting recommended attributes for articles or products is an intuitive and simple process.When you publish new content or edit existing content on the AnQiCMS backend, you can find the corresponding settings items.

First, please log in to your AnQiCMS administrative interface, navigate to the "Content Management" module, and select "Publish Document" or "Document Management" to edit the article or product you want to tag.

In the content editing page, you will see a name calledRecommended attributeThe area where. Here are various preset attribute types for you to choose from, usually represented by a Chinese character and the letter code within parentheses, such as:

  • Headline [h] : Usually used in the most prominent position on the homepage, such as large focus images or featured news.
  • Recommend [c]: Suitable for general recommendation content, which can be flexibly displayed in article lists, sidebars, etc.
  • Slide [f]: Suitable for content used in carousel or slide show areas, emphasizing visual effects.
  • Special recommendation [a]: A higher level of special recommendation than 'Recommended', which can be used as a secondary focus content.
  • Scroll [s]: Suitable for news scrolling, announcements, and other content that needs to be updated dynamically.
  • Bold [h]: Here the "h" is duplicated with the "h" of the headline, but it represents bold text in the recommended properties, usually used to highlight titles in lists.
  • Image [p]: Tagged as containing important images, articles or products, making it easy to display in the image aggregation area.
  • Jump [j]: If the content does not display directly but instead jumps to an external link or another page within the site, this property can be used.

You can select one or more recommended attributes for each article or product based on the actual importance and display requirements.For example, an important article that is both a headline news and contains beautiful pictures can check both It should be noted that although it can be selected multiple times, when calling and displaying in the front-end, it will usually be filtered for a specific attribute.

After selecting the properties, please make sure to save your content so that these recommended properties can take effect.

Second, display recommended content in categories in the front-end template.

In AnQiCMS, the display logic of content is mainly realized through template tags. To classify and display content with specific recommendation attributes on the front page, we need to utilizearchiveListTag, and combine it withflagFilter the parameters.

archiveListTag is a powerful tool to get lists of articles, products, and other content. By using inarchiveListSet in the labelflagparameters, you can specify to only get content with specific recommended attributes.

For example, if you want to display a "Top News" section on the homepage, showing only those articles marked as "Top [h]", you can use it like thisarchiveListTags:

{# 显示文章模型中被标记为“头条”的内容 #}
{% archiveList headlines with moduleId="1" flag="h" limit="5" %}
    {% for item in headlines %}
        <a href="{{ item.Link }}">{{ item.Title }}</a>
        {# 更多内容字段,如: item.Thumb, item.Description 等 #}
    {% endfor %}
{% endarchiveList %}

HeremoduleId="1"Typically represents the article model (the specific ID may vary depending on your configuration),flag="h"Then it accurately filters out content with the 'headline' attribute,limit="5"Controls the number of items displayed.}

If your requirement is to display a list of products marked as 'Recommended [c]' under a category page, you can do it like this:

{# 在当前分类下,显示产品模型中被标记为“推荐”的内容 #}
{% archiveList recommendedProducts with moduleId="2" flag="c" limit="8" %}
    {% for item in recommendedProducts %}
        <div class="product-item">
            <img src="{{ item.Thumb }}" alt="{{ item.Title }}">
            <h3><a href="{{ item.Link }}">{{ item.Title }}</a></h3>
        </div>
    {% endfor %}
{% endarchiveList %}

In this example,moduleId="2"It may represent a product model, whileflag="c"Then filter out the recommended products.

Important reminderIn the samearchiveListTag call, you can only use one.flagTo specify a recommended attribute for filtering. This means that if you want to display 'Headline' content and 'Slideshow' content on the same page separately, you need to use two separate parameters.archiveListTags, each tag is set differentlyflagParameter.

For example, display a slide area first, and then a general recommendation area below:

{# 幻灯片区域 #}
<div class="carousel">
    {% archiveList slideshowItems with moduleId="1" flag="f" limit="3" %}
        {% for item in slideshowItems %}
            <div class="carousel-item">
                <img src="{{ item.Logo }}" alt="{{ item.Title }}">
                <h4>{{ item.Title }}</h4>
            </div>
        {% endfor %}
    {% endarchiveList %}
</div>

{# 普通推荐文章区域 #}
<div class="recommend-list">
    {% archiveList generalRecommendations with moduleId="1" flag="c" limit="10" %}
        {% for item in generalRecommendations %}
            <li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
        {% endfor %}
    {% endarchiveList %}
</div>

In this way, you can flexibly classify and display content in various areas of the website based on the recommended attributes of the content, thereby optimizing the user's browsing experience and highlighting the core value of the website.


Frequently Asked Questions (FAQ)

  1. Ask: Can I add multiple recommended attributes at the same time in the article or product content? Answer:Yes, when editing content on the AnQiCMS backend, you can select multiple recommended properties in the "Recommended Properties" area at the same time (for example, select both "Headline" and "Image"). The content will have these properties simultaneously, but when you call it on the front end, it is usually throughflagSpecify one of the properties to filter and display.

  2. How can I display different recommended content on the homepage? For example, I want to display 'Top Stories' articles at the top of the page and 'Recommended' articles in the sidebar. Answer:You need to write multiple tags in the home page templatearchiveListEach tag is configured differentlyflagParameters to call them separately. For example, onearchiveListTags are used forflag="h"to get the headline articles, and anotherarchiveListTags are used forflag="c"to get the recommended articles.

  3. Ask: Does the recommended attribute have an impact on the website's SEO? Answer:The recommended attribute does not directly improve your search engine ranking.But by reasonably utilizing recommended attributes, you can better organize the website content structure, highlight important information, increase user stay time and interaction within the site, and these indirect factors are beneficial for SEO.A clearer content hierarchy and user experience helps search engines better understand and crawl your website.