How to use the `archiveList` tag to get documents with specific recommended attributes (such as "Top Stories" or "Slideshow")?

Calendar 👁️ 61

As an experienced website operations expert, I know that the core value of the Content Management System (CMS) lies in its flexibility and content scheduling capabilities.AnQiCMS (AnQiCMS) leverages its efficient architecture based on the Go language and rich features to provide strong support for content operations.archiveListLabel, accurately retrieve and display documents with specific recommended attributes, such as the 'headlines' news of a website or important content for 'slideshow' rotation.


Advanced operation of Anqi CMS content: How to usearchiveListTags, accurate filtering and recommendation documents

In the ever-changing Internet environment, the effective presentation of content is directly related to user experience and information transmission efficiency.For content operators, how to place the most important and attractive content in a prominent position is the key to improving website activity and conversion rates.archiveListThe tag is the tool to solve this problem. It not only helps us flexibly list various documents, but also can realize the 'intelligent' scheduling of content through fine-grained recommendation attribute filtering.

UnderstandingarchiveListThe core of content scheduling

In the template system of Anqi CMS,archiveListTags are a universal tool for retrieving document lists. Whether it's articles, products, or other custom content models, as long as they are categorized as “documents”,archiveListIt can be put to use.It is not just a simple data pull, but also provides rich parameter options, allowing us to customize the required list based on categories, modules, sorting methods, or even search keywords.

When we talk about 'recommended attributes', we are actually utilizing the 'Flag' attribute set for each document in the Anqi CMS backend document management.These Flag attributes (such as headline, recommendation, slideshow, etc.) are strategic markers of the importance and display form of the document by content operators.archiveListThe cleverness of the label lies in its ability to accurately identify these Flags and thereby filter out the specific content we want to display.

Revealing the core parameters:flagThe妙use of properties

To bearchiveListFilter out documents with specific recommended attributes, the most critical parameter isflag.When adding documents in the Anqi CMS backend, we can check the 'recommended attributes' for documents, such as 'headlines[h]', 'recommended[c]', 'slides[f]', and so on.These properties correspond to short letter codes.archiveListlabels, we just need to use these letter codes asflagthe value of the parameter to complete the filtering.

For example, if you want to get the "headlines" article on the homepage of the website, the corresponding Flag code ish. Then, you can call it in the templatearchiveListlike this:

{% archiveList headlines with type="list" limit="5" flag="h" %}
    {% for item in headlines %}
    <div class="headline-item">
        <a href="{{ item.Link }}">
            <h3>{{ item.Title }}</h3>
            <p>{{ item.Description|truncatechars:80 }}</p>
        </a>
    </div>
    {% else %}
    <p>暂无头条文章。</p>
    {% endfor %}
{% endarchiveList %}

In this code block,flag="h"Explicitly tell the system to only retrieve documents marked with the 'headline' attribute.limit="5"It limits to only display the latest 5 entries.type="list"It indicates that we do not need pagination, it is just a simple list.forLoop through the obtainedheadlinesvariable, and output the document title, link, and summary. If there are no documents that meet the criteria,{% else %}Part will friendly prompt "No headline articles available", improving user experience.

Case study: Diversified content display strategies

MasteredflagAfter the parameters, we can flexibly use it in various areas of the website to achieve diversified content display.

1. Create the homepage slideshow carousel

The slide area of the website is usually used to display important content with strong visual impact and large information volume. Such documents are often accompanied by exquisite pictures and marked with the "slide" attribute (Flag code isf)

<div class="carousel-container">
    {% archiveList slides with type="list" limit="3" flag="f" order="id desc" %}
        {% for item in slides %}
        <div class="carousel-item">
            <a href="{{ item.Link }}">
                {% if item.Thumb %}
                <img src="{{ item.Thumb }}" alt="{{ item.Title }}" class="carousel-image">
                {% else %}
                <img src="/static/images/default-slide.jpg" alt="默认幻灯图片" class="carousel-image">
                {% endif %}
                <div class="carousel-caption">
                    <h4>{{ item.Title }}</h4>
                    <p>{{ item.Description|truncatechars:100 }}</p>
                </div>
            </a>
        </div>
        {% else %}
        <p>暂无幻灯内容。</p>
        {% endfor %}
    {% endarchiveList %}
</div>

Here we go throughflag="f"Filter the slide content and useitem.ThumbGet the thumbnail to ensure the visual effect of the slide.order="id desc"Ensures that the latest slide content is displayed first.

2. Category page sidebar recommendation

On a specific category page, you may want to display some "recommended" articles under the category in the sidebar (Flag code is c)

<aside class="sidebar-recommendations">
    <h4>本类推荐</h4>
    <ul>
        {% archiveList recommendedArticles with type="list" categoryId=archive.CategoryId limit="10" flag="c" order="views desc" %}
            {% for item in recommendedArticles %}
            <li><a href="{{ item.Link }}">{{ item.Title|truncatechars:30 }}</a></li>
            {% else %}
            <li>暂无推荐文章。</li>
            {% endfor %}
        {% endarchiveList %}
    </ul>
</aside>

In this example, we not only usedflag="c"to filter recommended articles, but also combinedcategoryId=archive.CategoryIdto ensure that only recommended content from the current category is obtained.order="views desc"Then let the recommended articles with the highest number of views be displayed first. This showsarchiveListThe powerful ability of combining tag parameters, allowing you to accurately filter based on multiple conditions.

3. Get and display the document's Flag property (if needed)

Sometimes, you may want to display the recommended properties of documents directly in the article list, making it clear to the user. At this time, in addition to usingflagparameters for filtering, you also need toarchiveListaddshowFlag=trueand loop through ititem.Flagto retrieve and display it.

{% archiveList recentPosts with type="list" limit="10" showFlag=true %}
    {% for item in recentPosts %}
    <div class="post-item">
        <h3>
            <a href="{{ item.Link }}">{{ item.Title }}</a>
            {% if item.Flag %}
            <span class="post-flag">({{ item.Flag }})</span> {# 例如显示 "(h)", "(f)" #}
            {% endif %}
        </h3>
        <p>{{ item.Description|truncatechars:120 }}</p>
        <small>发布于: {{ stampToDate(item.CreatedTime, "2006-01-02") }} | 浏览量: {{ item.Views }}</small>
    </div>
    {% else %}
    <p>暂无最新文章。</p>
    {% endfor %}
{% endarchiveList %}

here,showFlag=trueLetitem.Flagproperty is available, we can display it next to the title

Related articles

How to exclude documents of a specific category in `archiveList` to display accurate content?

As an experienced website operations expert, I am well aware of the importance of accurate content display for user experience and website operation efficiency.In a content management system, we often encounter the need to exclude certain specific categories of documents when generating article lists, in order to ensure the relevance and focus of the content.AnQiCMS (AnQiCMS) is an efficient and flexible content management tool that provides us with a very convenient solution.

2025-11-06

How to filter and display documents based on multiple category IDs for the `archiveList` tag?

As an experienced website operations expert, I fully understand that the flexibility of a content management system is crucial for efficient operations.AnQiCMS (AnQiCMS) provides us with great convenience with its powerful template tag system.Today, let's delve deeply into a very practical feature: how to use the `archiveList` tag to filter and display documents based on multiple category IDs, thereby creating more targeted and attractive content modules.

2025-11-06

How to use the `archiveList` tag of AnQiCMS to get the document list under a specified content model?

AnQiCMS Content Management: The secret to accurately obtaining the document list with the `archiveList` tag As an experienced website operations expert, I know that the core value of a content management system (CMS) lies in its ability to organize and display content.In the AnQiCMS, this efficient and flexible Go language content management system, the `archiveList` tag is undoubtedly a powerful weapon in the content display process.It is not just a simple content call tag, but also a key bridge connecting your website content model with the front-end display logic.

2025-11-06

`archiveFilters` label can be combined with AnQiCMS's multilingual support to provide multilingual filtering conditions?

As an experienced website operations expert, I have accumulated rich experience in the content management and operations practice of AnQiCMS.Today, we will delve into a commonly discussed issue by users: Can AnQiCMS's `archiveFilters` tag be combined with multilingual support to provide multilingual filtering conditions?To answer this question, we need to understand the multilingual mechanism of AnQiCMS and the working principle of the `archiveFilters` tag.AnQiCMS as an enterprise-level content management system

2025-11-06

How to implement sorting of the document list by views or publication time using the `archiveList` tag?

As an experienced website operations expert, I know that the core value of a content management system (CMS) lies in its flexibility and the efficiency of content presentation.AnQiCMS (AnQiCMS) excels in this aspect with its efficient architecture in the Go language and a rich set of features.Today, let's delve deeply into a function that is extremely commonly used in content operation: how to use the `archiveList` tag to sort the document list by views or publication time.Content sorting seems simple, but it actually contains profound operational strategies.

2025-11-06

How to set the display quantity and offset for the `archiveList` tag in AnQiCMS to achieve pagination?

As an experienced website operations expert, I know that an efficient and flexible list display method is crucial for user experience and website performance.AnQiCMS (AnQiCMS) provides us with great convenience with its powerful template tag system.Today, let's delve into how to cleverly set the display quantity and offset using the AnQiCMS `archiveList` tag to achieve a smooth pagination effect.

2025-11-06

How to use the `archiveList` tag to perform keyword search (using `q` parameter) to filter documents on the frontend page?

## Unlock AnQiCMS: Use the `archiveList` tag to implement keyword search and content filtering on the front-end page As an experienced website operations expert, I am well aware of the importance of an efficient and flexible content management system for enterprises.AnQiCMS, this system developed based on the Go language, with its excellent performance and rich features, is becoming the preferred choice for an increasing number of small and medium-sized enterprises and content operation teams.In today's era of information explosion, whether users can quickly find the content they need is directly related to the user experience and conversion rate of the website.

2025-11-06

How to retrieve related content of the current document using the `archiveList` tag's `type="related"` mode?

As an experienced website operations expert, I am very happy to delve deeply into the `archiveList` tag in AnQiCMS with the `type="related"` mode, which plays a crucial role in content operations and can effectively improve user experience and the website's SEO performance. --- ## In-depth Analysis of AnQiCMS's `archiveList` Tag: How to intelligently retrieve related content and enhance user experience In such an efficient and customizable content management system as AnQiCMS

2025-11-06