How to call the recommended attributes of AnQiCMS document in the front-end template?

As an experienced CMS website operation personnel in a security company, I know how to attract and retain users through precise content display.In Anqi CMS, the 'recommended attribute' is an extremely useful feature that allows us to finely mark content, thereby enabling flexible calls and display on the website front end.Below, I will elaborate on how to call these recommended properties in the front-end template.

The AnQi CMS backend management system provides the core feature of "recommended attributes", which is located on the document (or other content model) editing page.Here, you can specify up to eight different recommendation attributes for each piece of content to differentiate the display on the front end.These properties include: Headline[h], recommended[c]of slides[f], special recommendation[a], scroll[s], bold[h](Note: at this[h]and the headlines'[h]The code is the same, usually the priority of the headline is higher)、image[p]and jump[j]Each attribute corresponds to a single-letter code. After you check the corresponding attribute in the background, the Anqi CMS will mark the content accordingly. These tags are the basis for the front-end template to call the content.By reasonably setting these properties, we can effectively highlight important content and guide users' attention.

Invoke this content with recommended attributes in the front-end template, which mainly depends on the Anqicms providedarchiveListTag. This powerful tag allows us to filter and display content lists based on various conditions. To call content with specific recommendation properties, we need to use in the tagarchiveListthe tag.flagThe parameter, and the single-letter code of the recommended attribute as its value. For example, if you want to display the article marked as 'recommended' in an area[c]you can use in the templateflag="c"This parameter tells AnQi CMS to only return those content items with the specified recommendation attributes.

Here is an example code for calling a "recommended" article list.

<div class="recommended-articles">
    <h2>精选推荐</h2>
    <ul>
        {% archiveList recommendedArchives with type="list" flag="c" limit="5" %}
            {% for item in recommendedArchives %}
                <li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
            {% empty %}
                <li>暂无精选推荐文章</li>
            {% endfor %}
        {% endarchiveList %}
    </ul>
</div>

In this code block,archiveListTags are used to retrieve content lists.type="list"Specifies the type of list,flag="c"Then accurately filtered out the articles marked as "recommended,"limit="5"Limited the number of displayed items to 5.forLoop through the returneditemAnd output the title and link of the article. If there are no articles that meet the conditions,emptythe content within the block will be displayed.

It is worth noting that the Anqi CMS.flagThe principle of parameter design is that each timearchiveListAn attribute can only be filtered once. This means that if you need to display "Headline" content and "Slideshow" content in different areas of the page, you will need to use independentarchiveListLabel. Each label will be configured to be uniqueflagParameters to ensure content is displayed as expected. This design ensures clear division and management of content blocks, avoiding content confusion.

Here is an example of how to create multiple recommended attribute content blocks:

<div class="headline-section">
    <h3>最新头条</h3>
    {% archiveList headlines with type="list" flag="h" limit="1" %}
        {% for item in headlines %}
            <p><a href="{{ item.Link }}">{{ item.Title }}</a></p>
        {% empty %}
            <p>暂无头条内容</p>
        {% endfor %}
    {% endarchiveList %}
</div>

<div class="slideshow-items">
    <h3>精彩幻灯</h3>
    <ul>
        {% archiveList slideshows with type="list" flag="f" limit="3" %}
            {% for item in slideshows %}
                <li><img src="{{ item.Thumb }}" alt="{{ item.Title }}"><a href="{{ item.Link }}">{{ item.Title }}</a></li>
            {% empty %}
                <li>暂无幻灯内容</li>
            {% endfor %}
        {% endarchiveList %}
    </ul>
</div>

Except throughflagScreening by parameters,archiveListthe tags also provideexcludeFlagandshowFlagParameters, to achieve more fine-grained control.excludeFlagThe parameter allows you to exclude content with specific recommendation attributes when retrieving a content list. For example,excludeFlag="h"It will return all content but exclude items marked as "Top News".showFlag=trueYou can include all the recommended property codes marked in each content item data (such ashcfetc.), you can use them in the template.{{item.Flag}}To obtain and display as needed. This is very useful for scenarios where you want to display a "headline" or "recommendation" tag next to the title.

As a website operator, we should fully utilize these recommended attributes to optimize the user experience and content marketing strategy.Mark the most important article as a 'headline' and place it in a prominent position, mark visually appealing content as a 'slider' for carousel display, or mark specific products as 'recommended' to guide purchase intention.Regularly check and update the recommended properties of the content to ensure that the front end of the website always displays the latest and most relevant key information.By such refined operation, the recommendation attribute function of Anqi CMS can help us manage content more efficiently and enhance the overall attractiveness and operation effect of the website