In website operation, we often need to classify and filter content lists more finely to help users quickly find the information they are truly interested in.Traditional article classification can solve most problems, but when the content attributes become more complex, such as products having multiple characteristics, price ranges, or events having different themes and participation methods, a single classification seems inadequate.
幸运的是,AnQiCMS(AnQiCMS)with its flexible content model and powerful template tags, provides us with an effective way to implement custom parameter filtering for article lists. This allows us to transcend traditional classification limits, to filter multi-dimensionally based on unique attributes of article or product content, thereby greatly enhancing the efficiency and experience of users in searching for content.
How can this feature be implemented in AnQi CMS?This mainly consists of several core steps: defining custom content parameters, publishing content with these parameters, and integrating filtering logic into the website template.
1. Define custom content parameters: Give your content more attributes
To implement filtering based on specific parameters, you first need to ensure that your content model can store these parameters. The "Flexible Content Model" feature of Anqi CMS is exactly for this purpose.
First, please enter the Anqi CMS background management interface, find“Content Management”Under the menu“Content Model”. Here, you can choose to edit an existing content model (such as "article model" or "product model") or create a new one according to your needs.
After entering the model editing page, you will see a“Content model custom field”area. Click add, and you can define various new properties for this model. For example:
- Product features:If you sell electronic products, you can add fields such as "color", "size", "processor model", etc.
- Parameter name:color
- Call field:color
- Field type:Single selection (and set optional values such as "red", "blue", "black")
- Price range:If you need to filter products of different prices, you can add the "price range" field.
- Parameter name:Price range
- Call field:price range
- Field type:Select dropdown (and set optional values such as "0-500", "501-1000", "above 1001")
- Service area:If the region *** is provided, the 'service_area' field can be added.
- Parameter name:service_area
- Call field:service_area
- Field type:Single-line text or single selection
Pay attention to defining these fields"Call field"This item, it will be the key identifier you refer to in the template. At the same time, choose an appropriate"Field type"It is also very important, as it determines the way users fill in data in the background, and indirectly affects the implementation of front-end filtering (for example, single-choice fields may be represented as radio buttons or drop-down menus on the front end).
2. Post content with custom parameters: providing data foundation for filtering
After completing the customization of the content model's parameters, the next step is to fill in the corresponding data for these fields when you publish a new article or edit existing content.
Under "Content Management", select "Publish Document" or edit an existing document. After you have selected the corresponding "Category", (which is associated with the content model you have modified or created), the "Other Parameters" section of the page will display the custom fields you have just defined.Make sure to enter accurate and standardized data for these fields. These data will be the basis for future front-end filtering, and the more accurate the data, the more precise the filtering results will be.
3. Integrate the filter controller in the template: allow users to select filter conditions
Now, we have content with custom parameters and we want to display these parameters on the article list page, so that users can click to filter.This step requires you to modify your front-end template file.
AnQi CMS providesarchiveFiltersTag, specifically used to generate these dynamic filter menus. It will