`archiveFilters` label can be combined with AnQiCMS's multilingual support to provide multilingual filtering conditions?
As a senior website operations expert, I have accumulated rich experience in the content management and operations practice of AnQiCMS. Today, we will delve deeply into a common issue that users are concerned about: AnQiCMS'sarchiveFiltersCan the tag be combined with multilingual support to provide language filtering conditions?
To answer this question, we need to understand the multilingual mechanism of AnQiCMS andarchiveFiltersThe working principle of tags. AnQiCMS, as an enterprise-level content management system, its multilingual capability is one of its core advantages, aimed at helping users expand their global market.
The multi-language mechanism of AnQiCMS: basics and scope
According to the official document of AnQiCMS, the system provides powerful multilingual support.It allows users to switch and display multilingual content, which is crucial for global content promotion.For example, by setting the default language package in the background, the system interface and some built-in prompts can be displayed in the selected language.Furthermore, throughlanguagesTags, template developers can easily implement language switching functions on the front-end and generate SEO-compliant contenthreflang.
However, it is important to note that AnQiCMS's multilingual support mainly manifests in the language switching of the system interface, template level, and content distribution.The document clearly states: “This is only to modify the built-in text, and the articles on the template as well as the document.”Categorization content text, it will not change due to the language package set here.This means that for user-defined content such as article titles, content, category names, and the filter criteria values we are about to discuss, the system will not automatically translate.
archiveFiltersLabel: The foundation of dynamic filtering
archiveFiltersThe tag is a very practical feature in AnQiCMS, it allows us to dynamically generate filtering conditions based on the custom fields defined in the document content model.For example, on a real estate website, you can generate filters based on custom fields such as 'property type', 'location', 'price range', etc.
The usage method of this label is as follows:{% archiveFilters filters with moduleId="1" allText="全部" %}It will output an array object containing filtering parameters (filters), each parameter also contains its name (Name), field name (FieldName)and a series of options(Items)ItemsEach element contains aLabel(Display text of the filtered value)andLink(URLs after clicking the filter)。TheseLabelThe text directly comes from the default value you set in the content model custom field or the specific value you choose when entering content.
Combining challenges and strategies: Implementing multilingual filtering conditions
How do we return to the core issue: how to letarchiveFiltersProvide multi-language filtering options? Considering that AnQiCMS does not automatically translate custom content, we need to adopt some strategies to make up for this.
The core of the challenge lies in: archiveFiltersLabel outputLabelThese values are based on the preset content model or the actual values filled in the content, which are not keys in the multilingual dictionary, and the system cannot automatically translate them into the current website language.
Here are several feasible strategies, each with its advantages and disadvantages, suitable for different scenarios:
1. Independent management of multi-site/multi-language instances (recommended for strict separation)
If your business requires a very high level of independence in multilingual content and filtering, and has sufficient budget and management resources, the most direct and thorough way is to set up a separate AnQiCMS site instance for each language, or to create independent sub-sites for each language using AnQiCMS's multi-site management feature.
- Advantage:Each site's content, filtering conditions, and even custom fields can be fully independently configured, without interference, and managed clearly.
- Shortcomings:Increased operational and maintenance costs, content may need to be entered repeatedly or synchronized across sites.
- Implementation method:In each language version of the site, define the custom fields and their default filter options in the content model according to the language requirements.For example, the English site is configured with “Apartment”, “Villa”, and the Chinese site is configured with “Apartment”, “Villa”.
archiveFiltersTags will naturally display the filtering conditions of the current site language.
2. Utilization within a single site.trLabel for front-end translation (recommended for fixed and controllable filtering conditions)
This is a common and relatively economical method to implement multi-language filtering conditions in a single AnQiCMS instance. The core idea is to letarchiveFiltersOutput the original (usually the main language) filtered value, then use the AnQiCMS translation tagtrConverted and displayed on the front end.
- Implementation steps:
- Custom field definition of content model:Define custom fields in the content model (for example
PropertyTypeSet a default filter option for it. These values should use a unified "key" or master language (for example, "Apartment", "House"). - Enter content:When publishing documents, select or fill in the corresponding (primary language) values for these custom fields.
- Language package configuration:Create in your template directory
localesFolder, and configure corresponding for each languagedefault.ymlFile. In thisymlIn the file, translate all the filter value keys (such as "Apartment") and their translations in different languages
- Custom field definition of content model:Define custom fields in the content model (for example