As an experienced website operations expert, I know that how to efficiently organize and present information in an increasingly complex content ecosystem, while ensuring that users can easily find the content they need, is the key to enhancing the value of the website. AnQiCMS (AnQiCMS) with its flexible content model and powerful template system, has provided us with many powerful tools to achieve this goal, among which,archiveFiltersTags are undoubtedly a powerful tool for creating advanced content filtering functions.

Today, let's delve into the Anqi CMS template.archiveFiltersUnderstanding the 'Document Parameter Filtering' feature of tags can help us improve user experience and content management efficiency.


Unveiling Anqi CMSarchiveFiltersLabel: How to create a flexible and powerful document parameter filtering function

In the digital age, users' demand for information is becoming more precise and personalized.A great website, not just a pile of content, but also needs to provide convenient and intelligent filtering mechanisms to help users quickly locate the content they are interested in.A safe CMS deeply understands this, itsarchiveFiltersThe tag is born to solve this pain point, it gives the website the ability to 'document parameter filtering', making your content list no longer flat, but vivid and interactive.

The core concept of what isarchiveFilters?

In short,archiveFiltersTags are a powerful tool in the Anqi CMS template system, its core function lies inBased on the various custom parameters in the document, dynamically generate filtering conditions for users to select. This is different from the traditional filtering methods that only use categories or tags,archiveFiltersCan delve into the specific fields defined in your content model, such as product color, size, or property layout, area, etc., and convert these business parameters into intuitive filtering options on the front end.

The document clearly states,archiveFiltersPrimarily used forOn the document homepage or document classification template, and often combined with document pagination listsThis means it is usually found on pages that need to display a large amount of content and where users have a clear filtering requirement, such as product centers, case lists, news dynamics, and so on.It's like an intelligent shopping guide that can adjust the display list of content in real-time according to the specific preferences of the user.

AnQi CMS content model andarchiveFiltersTightly integrated with

It is necessary to fully understandarchiveFiltersThe power, we must first review the core advantage of Anqi CMS 'Flexible Content Model'.Our Anqi CMS allows us to customize content models according to business needs, for example, we can create a "Real Estate" model and define custom fields such as "house type", "area", "region", "price", etc.

These carefully defined custom fields in the background have becomearchiveFiltersthe foundation for playing a role. When you set a filter parameter for a field in the content model (for example, "house type"),archiveFiltersThe label can intelligently recognize and list all possible 'house type' options (such as 'one-bedroom', 'two-bedroom', 'three-bedroom') on the front-end page, and generate corresponding filter links for each option.

The cleverness of this mechanism lies in the seamless connection between the backend content structure and the frontend user interaction, greatly enhancing the manageability and flexibility of content display.

archiveFiltersLabel parameter parsing: precise control of filtering logic

archiveFiltersWhen the label is called, it usually goes with some parameters to finely control the behavior and display mode of filtering:

  • moduleIdThis parameter is crucial, it is used to specify which content model's documents you want to filter. For example, if you want to filter the parameters under the 'Real Estate' model, you need to specify the correspondingmoduleIdThis ensures that the filter can load the correct custom field of the content model.
  • allTextUser experience is often reflected in the details.allTextParameters allow you to customize the display text for default options like 'All' or 'Unlimited'. If you set it tofalseIt can be omitted to not display this overview option, which may be used in certain specific scenarios.
  • siteIdIf you are using the multi-site management feature of Anqicms and want to call or filter data across sites,siteIdParameters can be put to good use. It allows you to specify data for parameter filtering from a specific site.

These parameters work together to allow you to build a user filtering interface that is both logical and aesthetically pleasing according to your actual business needs.

Deep understandingarchiveFiltersThe output structure: how to build the front-end interface

When you call in the templatearchiveFiltersLabel and specify a variable name (such asfilters) After that, it will return a meticulously organized data structure for you to render in the front-end. Imagine that,filtersVariables are like a box full of filter categories, with specific filter options in each category.

To be specific,filtersis an array object, each element represents a filterable "parameter category", such as "house type", "area", etc. Each "parameter category" object contains the following key information:

  • NameThis is the display name of the parameter category, such as 'house type', 'house size', etc., which is directly displayed on the user interface.
  • FieldNameThis is the backend content model field name corresponding to the parameter category, used for internal logic processing.
  • ItemsThis is a deeper level array that contains all the optional filter values under the parameter category. For example, under the 'house type' category,Itemsit may include 'one-bedroom', 'two-bedroom', and so on.

AndItemsEach specific 'filter value' object in the array contains the following properties:

  • Label: Display text of the filter value, such as 'One-bedroom', '50-70 square meters', etc.
  • LinkThis isThe most criticalIt is a complete URL link, clicking it will refresh the page and apply the filter condition.archiveFiltersIt will automatically handle the concatenation of URL parameters, ensuring that the generated link is a usable filter results page.
  • IsCurrentA boolean value indicating whether the current filter value has been selected. This is crucial for highlighting the currently active filter conditions on the front end and providing visual feedback.

By cleverly utilizing this data, template developers can combineforloop andifjudgment, easily building dynamic and responsive filter menus. For example, you can loopfiltersCreate a first-level filter title and then nest loopsitem.ItemsList each filter condition and pass throughval.IsCurrentAdd for the currently selected itemactiveStyle.

Actual application scenario: Make content filtering more magical

archiveFiltersThe practical application scenarios are very extensive, not limited to real estate websites.

  • E-commerce websiteYou can use it to achieve multi-dimensional filtering of products, such as filtering by "brand", "color", "material", "target group", etc., which can greatly enhance the shopping experience of users.
  • news media or blog: In addition to the traditional filtering by "category" or "tag", you can also filter by custom fields such as "author", "source", "publishing year", even "article type" (such as in-depth reports, comments, and news), allowing readers to find the content they are interested in more quickly.
  • B2B industry website: Case display can be filtered by "industry", "solution type", "project scale", and other criteria to help potential customers quickly find service cases that meet their needs.

This parameter filtering flexibility not only improves user experience, but also helps with SEO optimization. ThrougharchiveFiltersA URL generated with specific parameters that can be crawled and indexed by search engines, thereby enhancing the website