Does the `archiveFilters` tag support filtering by numerical range, such as 'price range' or 'date range'?

Calendar 👁️ 55

In-depth analysis of AnQi CMSarchiveFiltersLabel: Does it support numeric range filtering?

As an experienced website operations expert, I am well aware of the importance of the flexibility of the filtering function in a content management system for user experience and content presentation.AnQiCMS (AnQiCMS) is favored in the content management field for its efficiency and customizable features.archiveFiltersEspecially regarding whether it supports filtering based on numerical ranges, such as the need for 'price range' or 'date range'.

archiveFiltersThe design philosophy and core functions of tags

First, let's understandarchiveFiltersThe positioning of tags in Anqi CMS. According to the official documentation,archiveFiltersThe label is mainly used for making list combination filtering conditions based on various document parameters.The original design was to facilitate website administrators to generate a set of predefined, discrete filtering options based on custom fields defined in the content model.For example, on a real estate website, you can filter by predefined categories such as 'house type' (residential, commercial) or 'house size' (single room, one bedroom and living room).

In the template, we usually use it like thisarchiveFilters:

{% archiveFilters filters with moduleId="1" allText="全部" %}
    {% for item in filters %}
        {# 遍历每个筛选维度,如“房屋类型” #}
        <ul>
            <li>{{item.Name}}: </li> {# 显示维度名称,如“房屋类型” #}
            {% for val in item.Items %}
                {# 遍历该维度下的具体选项,如“住宅”、“商铺” #}
                <li class="{% if val.IsCurrent %}active{% endif %}"><a href="{{val.Link}}">{{val.Label}}</a></li>
            {% endfor %}
        </ul>
    {% endfor %}
{% endarchiveFilters %}

From the above structure, we can see,archiveFiltersthe tags returned byfiltersA variable is an array object containing multiple filtering dimensions. Eachitemrepresents a filtering dimension, which hasName(parameter name),FieldName(parameter field name) andItems(optional values) and other properties. WhileItemsEach in the arrayvalalso includesLabel(Filter value),Link(Filter link) andIsCurrent(Whether selected) and other information. This clearly indicates,archiveFiltersThe core mechanism is to generate a set of predefined, discrete options for each custom field, and to generate corresponding filter links for these options.

archiveFiltersDoes it directly support numeric range filtering?

Directly answer this question:Currently, the Anqi CMS isarchiveFiltersThe tag does not directly support filtering based on numerical ranges (such as "price range" or "date range") in its original design.

This means that you cannot simply pass inarchiveFiltersto the tag.min_price/max_priceorstart_date/end_dateThis parameter, and expect it to automatically generate a filter interface containing range logic.This label is more focused on providing a set of preset options that users can click to select, each corresponding to a specific, discrete value.

For example, if you define a namedpricecustom field of the "numeric" type in the background content model,archiveFiltersIt will not automatically provide a slider or input box for the user to enter the minimum/maximum price for filtering. Instead, it will expect you topriceDefine a series of discrete 'price range' options (such as: 0-100 yuan, 101-500 yuan, 501-1000 yuan), and then generate filter links for these options.

How to implement a similar numerical range filter in Anqi CMS?

AlthougharchiveFiltersThe tag itself does not directly handle the range, but the flexibility of Anq CMS and its powerful template engine still provides ways to achieve similar effects.

  1. Defined by the background pre-defined discrete intervals:This is the most direct and conforms toarchiveFiltersThe method of design ideas.For numeric fields (such as price) or date fields (such as publication year) that require range filtering, you can pre-set the filtering options for these fields as discrete intervals in the content model on the backend.

    • Price range:Add custom options for the "PricearchiveFiltersThese options will generate clickable filter links, allowing users to select preset price ranges by clicking.
    • Date range:Similarly, you can define discrete options such as 'last week', 'last month', 'this year', 'last year', etc. for the 'publish date' field.This method sacrifices some dynamics, but it has already been able to meet the needs of users to filter through predefined conditions for most business scenarios.
  2. Combine front-end custom logic and backend parameter processing (advanced implementation):For scenarios where users need to input specific numbers (such as using a slider to select a price range) or select an exact date range through a date picker, this will require more in-depth custom development:

    • Front-end interaction:You need to write custom HTML form elements in the front-end template (such asinput type="range"sliders,input type="date"Date picker) and JavaScript code. These frontend codes are responsible for capturing user input and dynamically building URL query strings that include range parameters, such as?price_min=100&price_max=500Or?start_date=2023-01-01&end_date=2023-12-31.
    • Backend parameter processing:Of Security CMSarchiveListThe tag is intype="page"In this mode, it supports custom filtering through URL query parameters (as mentioned in the documentation)q="搜索关键词"or custom filtering parameterssex=男)。Therefore, if your content model containspriceorcreated_timesuch numeric or date fields, theoretically, when users submit through the front endprice_minandprice_maxWhen the parameters are given, the backend can perform range queries at the database level according to these parameters.This requires the backend to have corresponding logic to parse these custom range parameters and convert them into database query conditions.archiveFiltersThe tag does not generate these complex links with range parameters, but it does not prevent you from building a more powerful range filtering system through custom front-end and back-end logic.

Summary

Of Security CMSarchiveFiltersTags are an efficient and intuitive tool for filtering content based on predefined discrete options.It converts the custom fields from the backend into interactive filters on the frontend using a concise template syntax.However, the native function does not support direct numerical or date range filtering.To implement such advanced filtering, you can meet common needs by presetting discrete intervals in the background, or by combining custom frontend interaction and backend parameter processing to build a more flexible and dynamic solution.This demonstrates that AnQi CMS provides basic easy-to-use functions while also retaining sufficient extensibility to deal with complex business scenarios.


Frequently Asked Questions (FAQ)

1. WhyarchiveFiltersTags do not support direct numeric range filtering? archiveFiltersThe design intention of the tag is to convert predefined, discrete custom field options in the content model (such as "house type" or "region") into front-end filters. It achieves filtering by generating an independent link for each preset option.

Related articles

How to manually simulate the `archiveFilters` tag's filtering effect by modifying URL parameters?

As an experienced website operation expert, I know that AnQiCMS (AnQiCMS) is flexible and powerful in content management.In daily operations, we often need to accurately control the way content is displayed, the `archiveFilters` tag is one of the key tools to achieve this goal, and it can generate dynamic filtering conditions based on the various parameters of the document.However, understanding the mechanism behind the automatic generation of filter links through template tags, and learning to manually simulate these filtering effects, will bring greater flexibility and control to our content operations.

2025-11-06

What is the structure of the filtering link URL generated by the `archiveFilters` tag? Is it compatible with the pseudo-static rules?

As an experienced website operations expert, I often deal with various CMS systems in my daily work, and I know that every detail of a system is crucial in terms of content management, SEO optimization, and user experience.AnQiCMS (AnQiCMS) stands out in these aspects due to its lightweight and efficient features, especially the flexible use of template tags, which brings great convenience to website operations.

2025-11-06

Under multi-site management scenarios, how does the `siteId` parameter of the `archiveFilters` tag ensure that the correct site's data is filtered?

As an experienced website operations expert, I am well aware that efficient and accurate content management is the cornerstone of success in a complex digital environment.AnQiCMS (AnQiCMS) takes advantage of its powerful multi-site management capabilities, providing great convenience for operators.However, with the increase in the number of managed sites, how to ensure that the data filtered in specific scenarios comes from the target site we want, rather than the current site or other irrelevant sites, this involves a crucial parameter in the `archiveFilters` tag - `siteId`.###

2025-11-06

Does the `archiveFilters` tag support filtering user-defined "content model custom fields"?

As an experienced website operations expert, I am well aware of the importance of the flexibility of a content management system (CMS) in efficient operations, and AnQiCMS, with its powerful content model customization capabilities, has provided us with great convenience in this regard.Today, let's delve deeply into a question that concerns everyone: Does AnQiCMS's `archiveFilters` tag support filtering custom fields of the content model?

2025-11-06

How is the performance of the `archiveFilters` tag for models with a large number of filtering conditions? Are there any optimization suggestions?

## Taming massive filtering conditions: A deep dive into the performance analysis and optimization of the AnQiCMS `archiveFilters` tag As a seasoned website operations expert, I am well aware that performance is the key to user experience and operational efficiency when managing websites with a large number of content models and filtering conditions.AnQiCMS with its high-performance architecture based on the Go language is highly favored in the content management field.Today, let's delve into the core tag of AnQiCMS for handling complex filtering scenarios —— `archiveFilters`

2025-11-06

Does the `archiveFilters` tag support responsive layout and filtering display in mobile templates?

In the Anqi CMS ecosystem, many operators and developers are concerned about a core issue: whether our powerful `archiveFilters` tag can be flexibly responsive in mobile template layouts and display filtering?As an experienced website operations expert, I can clearly tell you that the answer is affirmative, but it contains the unique template design philosophy and implementation mechanism of Anqi CMS, which is worth in-depth exploration.

2025-11-06

Besides the document homepage and category pages, where else can the `archiveFilters` tag be used in the templates?

As a senior website operation expert, I fully understand that in order to truly bring out the value of CMS functions, one needs to deeply explore their potential and apply them to a wider range of scenarios.The Anqi CMS template tag system is designed to be quite flexible, and the `archiveFilters` tag is one of the tools that can greatly enhance the user's content filtering experience. It is clearly stated in the document that the `archiveFilters` tag is mainly used on the document homepage or document category templates, and is combined with the document pagination list.This is undoubtedly its most common and direct application scenario.

2025-11-06

How to display the number of documents under each filter option in the `archiveFilters` tag?

As an experienced website operation expert, I know that every detail can affect the final effect in terms of user experience and website data analysis.When a user is browsing the filter list, if they can clearly see the number of documents included under each filter option, it not only significantly improves their browsing efficiency but also helps them find the content they need faster, thus optimizing the conversion path.AnQiCMS (AnQiCMS) provides a solid foundation for us to meet this requirement with its flexible and powerful functions.Today, let's delve deeper into

2025-11-06