AnQiCMS as a powerful and highly flexible content management system, provides many conveniences for operators in terms of content display and management. Among them, archiveFiltersTags are a key tool for implementing dynamic content filtering. Today, we will delve into a common concern for operators: archiveFiltersCan the tag limit certain parameters to be available only under specific categories?
Deep analysisarchiveFiltersHow the tag operates
Firstly, let's understandarchiveFiltersThe core role of the tag. From the document, we can see,archiveFiltersTags are designed to build dynamic document parameter filtering conditions. When your website content, such as real estate information, product lists, etc., needs users to filter by various attributes (such as house type, area, color, size, etc.),archiveFiltersTags can be put to good use. They can automatically generate filter options for the front-end based on the document parameters you set, greatly enhancing user experience and content discoverability.
The basic usage is like this:{% archiveFilters filters with moduleId="1" allText="默认" %}...{% endarchiveFilters %}Here,moduleIdThe parameters explicitly state which 'content model' it will use to get the filtering parameters. For example,moduleId="1"represents the filtering parameters for the article model.
Core Clarification: The Relationship Between Module (Module) and Category (Category)
To answer the question 'Can we limit certain parameters to be available only in specific categories', we need to clarify the relationship between the 'Content Model' (Module) and 'Document Category' (Category) in AnQiCMS.
In the design philosophy of AnQiCMS, custom content parameters (i.e., used forarchiveFiltersthe 'parameters' for filtering arebound to the content model (Module) levelThis.This means that when you add custom fields such as 'House Type', 'Color', 'Size', etc. for the 'Article Model' or 'Product Model' in the background, these fields will become potential properties of all documents under this content model.
The 'Document Classification' is organized and subdivided under the 'Content Model'. A classification always belongs to a specific content model. Therefore, when you are using a classification pagearchiveFiltersTags, it will default (or according to your specificationmoduleIdparameters) to load the content model under the category it belongs toall the defined filter parameters.
So, the direct answer is: archiveFiltersThe label itself cannot pass its parameters (such as passing incategoryIdIt always provides all filter parameter options based on the associated 'content model' to limit it to display only the filtering parameters专属 of a specific category.
How to implement a 'look' category-specific filter?
AlthougharchiveFiltersTags are module-level in the underlying logic, but as a senior operations expert, we always have ways to present the effect of 'category-specific filtering' through flexible strategies. Here are several practical methods:
Template-level control:This is the most commonly used and flexible method.
- Use dedicated templates for different categories:AnQiCMS supports setting custom templates for each category. For example, you might have a 'Real Estate Category' using
house-list.htmltemplates, while a 'News and Information' category usesnews-list.htmltemplates. - Selectively render in the exclusive template.
archiveFilters:In the "Property Category".house-list.htmlIn the template, you can fully render all the filtering parameters related to properties. And in the "News and Information".news-list.htmlIn the template, you can choose not to render.archiveFiltersTags, or only render a small number of general parameters that are meaningful for news articles (if any). - CSS/JavaScript Dynamic Hide:Even if all module-level parameters are rendered, you can selectively hide some irrelevant filter options on specific category pages by writing CSS or JavaScript code, thus achieving a 'category exclusive' effect visually.This method may not be elegant, but it is very practical in some complex scenarios.
- Use dedicated templates for different categories:AnQiCMS supports setting custom templates for each category. For example, you might have a 'Real Estate Category' using
Refined Design of Content Model:
- If the content between your different "categories" varies greatly, and the required filtering dimensions do not overlap at all, then it may have been advisable to consider grouping them together from the very beginning.Different content modelsFor example, real estate information should have an independent "real estate model", and product information should have an independent "product model". Different models have their own independent set of custom fields.
archiveFiltersWhen calling different models, different filtering parameters will naturally be displayed. This method solves the problem at the system architecture level, but requires good design in the content planning stage.
- If the content between your different "categories" varies greatly, and the required filtering dimensions do not overlap at all, then it may have been advisable to consider grouping them together from the very beginning.Different content modelsFor example, real estate information should have an independent "real estate model", and product information should have an independent "product model". Different models have their own independent set of custom fields.
Utilize
archiveListThe data filtering capability:- even if
archiveFilterslists all module-level parameters, and the final filtering effect is still completed byarchiveListthe tags.archiveListWhen processing filter parameters, it will only match based on the actual documents present under the current category. This means that if a 'news category' document has never set the 'house area' parameter, then evenarchiveFiltersThe label displayed 'House Area' filter option, and the user will only get an empty result after clicking, which indirectly indicates that this parameter is not suitable for this category.Although this method does not have a clear 'hide', it can still guide users.
- even if
Summary
Anqi CMS'sarchiveFiltersTags are a powerful tool that provides rich document parameter filtering based on a content model. Although it cannot filter directly at the tag level based oncategoryIdLimit the available parameters, but through clever template design, reasonable content model planning, and front-end presentation control, we can fully achieve a filtering experience that meets specific category requirements, making website content management both efficient and flexible.
Common Questions (FAQ)
Question: If my website has articles and products as two types of content, and they both require different filtering parameters, how should I set it up? Answer:The practice is to create different 'content models' for 'articles' and 'products' separately (for example, the system default article model and product model).Then define dedicated custom fields under their respective models (such as 'author' and 'source' for articles, 'color' and 'size' for products).
archiveFiltersWhen it is called, it will display relevant parameters based on the article model; when called on the product list page, it will display product parameters based on the product model, naturally achieving isolation.Question: Can I display only the desired filter parameters on a category page and hide other irrelevant parameters for that category? Answer:Can be. You can set a dedicated category template for this specific category. In this category template, you can manually selectively render
archiveFiltersThe content filtered out by the tag, or using CSS styles (such asdisplay: none;) to hide irrelevant filter options, thus visually presenting only the filter parameters relevant to the current category.Q:
archiveFiltersDoes the displayed parameter automatically filter out the filter values without content? Answer:archiveFiltersThe label itself lists all the parameters defined by the content model and their preset optional values (if the parameter type is single-choice, multiple-choice, etc.). As for whether there is actual document content under a specific filter value on the specific page, this is determined by the system after the user performs the filtering operation.archiveListCombine label with database query to complete.archiveFiltersMainly responsible for presenting “Filterable options”.archiveListResponsible for “executing the filter and displaying the results”.”} ]