As an experienced website operations expert, I am well aware that in this era of content explosion, how to efficiently organize and display content so that users can quickly find the information they need is the key to improving user experience and SEO performance.AnQiCMS (AnQiCMS) with its powerful feature set provides us with many operational tools.Today, let's delve into a seemingly simple yet potentially powerful combination application: how to cleverly combine the 'keyword library' and 'content model' of AnQi CMS toarchiveFiltersFunction injection introduces richer filtering vocabulary, thus building a more intelligent and user-friendly content filtering system.
Skillfully utilize the 'Keyword Library' and 'Content Model' of AnQi CMS: constructarchiveFiltersPractical guide to a rich filtering system
In a content management system, the content filtering function is like the navigation system of a website, directly affecting the efficiency and satisfaction of users in discovering information. Anqi CMS providesarchiveFiltersThe label is the core tool for building this 'navigation system'.However, relying solely on the default settings is far from enough to make this tool operate at its best.We need to deeply explore the 'keyword library' and 'content model' functions of Anqi CMS, providing more accurate and rich filtering dimensions for the filter.
1. Deep understandingarchiveFiltersThe foundation of content filtering
First, let us clearly understandarchiveFilters. According to the Anqi CMS template tag document,archiveFiltersis specifically designed fortemplate for the document home page or document categoryDesign, intended to perform list combination filtering based on the various parameters of the document.It allows us to flexibly display various filtering conditions such as 'House Type', 'Area', 'Price Range' on the front-end page, significantly improving user experience, and providing an excellent opportunity for long-tail keyword SEO optimization.
The key here is:archiveFiltersThe "document parameters" relied on do not directly come from the "keyword library" of the background, but rathercustom fields defined in the content model. This means that to enricharchiveFiltersThe filtering dimension, we need to start from the content model rather than directly adding vocabulary to the keyword library.
2. The real positioning and indirect value of the "keyword library".
So, what role does the 'keyword library' of Anqi CMS play in this process? It does not directly providearchiveFiltersProvide front-end filtering options. Conversely, the core value of the keyword library is reflected in the following aspects:
- Centralized management and standardization:The keyword library provides a unified place to manage the important keywords of the website, ensuring that content creators can use standardized, highly relevant vocabulary to the website theme when publishing documents.It is crucial for maintaining the overall professionalism and consistency of the website.
- Content creation efficiency:On the "Publish Document" interface, content creators can directly select keywords from the keyword library to avoid manual input and spelling errors, greatly improving work efficiency.
- SEO optimization foundation:The keywords in the library are an important basis for SEO optimization.They can be used for article meta keywords, anchor text settings in content, and even through the "site-wide content replacement" feature to batch implement keyword internal link deployment, thereby improving the relevance and weight of the page.
- Auxiliary content strategy:By analyzing the keyword library, operators can more clearly understand the key direction of website content and the focus of user concerns, providing data support for future content planning.
Although the keyword library does not provide direct filtering options, it ensures that the content's keyword annotations are standardized and consistent.This consistency lays a good foundation for subsequent filtering through custom fields, because users may base their filtering on their understanding of these keywords.
3. Build richarchiveFiltersFiltering system: The core lies in the customization of content model fields
To truly bearchiveFiltersProvide rich and practical filtering vocabulary, our focus is on the powerful AnQi CMS.Custom fields for content modelFunction. AnQi CMS allows us to add any number of custom fields for different content models (such as articles, products, real estate information, etc.). These fields arearchiveFiltersParameters that can be recognized and utilized.
The detailed steps to build this system are as follows:
Define the screening dimensions and business requirements:Before starting the hands-on operation, we should first clarify what filtering conditions the website users may need.For example, for an e-commerce website, users may need to filter by 'brand', 'color', 'size', 'material', and so on;For a real estate website, it may be necessary to filter by 'area', 'house type', 'rental/sale type', 'renovation status', and so on.In-depth user research and market analysis is the key to this step's success.
Create custom fields in the content model:Log in to the AnQi CMS backend, go to 'Content Management' -> 'Content Model', select the target model you need to add the filtering function (such as 'Product Model' or create a new 'Real Estate Model').Click "Content model custom field" under "Add field", create a custom field for each confirmed filtering dimension.Here are some key points:
- Parameter name:User-friendly, easy-to-understand Chinese name (such as "brand", "house type").
- Call field:English lowercase letters, which will be used in the template to identify the field.
FieldNamefor examplebrand/house_type) - Field type:This is the most important step. In order to support
archiveFiltersdropdown or multi-select filtering, we should prioritize:- Single selection (Radio):options that are mutually exclusive, such as "Type of Tenancy" (rental/sale).
- Multiple selection (Checkbox):Suitable for multi-selectable filters, such as “facilities” (parking spaces, gardens, terraces).
- Select (Select):Suitable for filters with many options but single selection, such as “brand”, “region”.
- Default:Here, we need to preset all possible filter options.For example, if the field is "house type", the default values can be entered one per line: "one bedroom one living room", "two bedrooms one living room", "three bedrooms two living rooms".These default values will become
archiveFiltersinItemsofLabel.
Fill normalized data for the document content:After the custom field is created, these custom fields will appear in the "Other Parameters" collapse box when publishing or editing the document under the corresponding model.Ensure that content editors strictly fill in data according to the preset options (or standardized format).This is the foundation for the normal operation of the filter function, any irregular data may cause the filter to fail or the results to be inaccurate.
Call in the front-end template
archiveFiltersTags:Now, we can use it in the list page or category page template that requires a filter function,archiveFiltersLabel to display these custom filter conditions. “`twig {# Example: Call the filter on the product list page #}<h3>商品筛选</h3> {% archiveFilters productFilters with moduleId="2" allText="不限" %} {# moduleId为产品模型的ID #} {% for item in productFilters %} <div class="filter-group"> <span class="filter-name">{{ item.Name }}:</span> {# 显示“品牌”、“颜色”等参数名 #} <ul class="filter-options"> {% for option in item.Items %} <li class="{% if option.IsCurrent %}active{% endif %}">