As an experienced website operations expert, I have accumulated rich experience in the content management and operations of AnQiCMS. Today, we will delve into a commonly concerned issue by users: thearchiveFiltersCan the label be combined with multilingual support to provide multilingual filtering conditions?
To answer this question, we need to understand the multilingual mechanism of AnQiCMS,archiveFilters标签的工作原理。AnQiCMS作为一个企业级内容管理系统,其多语言能力是其核心优势之一,旨在帮助用户拓展全球市场。
AnQiCMS的多语言机制:基础与范围
According to AnQiCMS official documentation, the system provides strong 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.languagesTags, template developers can easily implement language switching functions on the front end and generate content that meets SEO requirementshreflangLabel.
However, it should be noted that AnQiCMS' multilingual support is mainly reflected in the language switching of the system interface, template level, and content distribution.The document explicitly states: "This will only modify the built-in text, as well as the articles on the template and the document.Category and other content text, it will not change due to the language pack set here.This means that for user-defined content, such as article titles, content, category names, and the filtering criteria values we are about to discuss, the system does not automatically translate.
archiveFiltersLabel: The Foundation of Dynamic Filtering
archiveFilters标签是AnQiCMS中一个非常实用的功能,它允许我们根据文档内容模型中定义的自定义字段,动态地生成筛选条件。For example, on a real estate website, you can generate filters based on custom fields such as 'Property Type', 'Area', 'Price Range', etc.
The usage of this label is as follows:{% archiveFilters filters with moduleId="1" allText="全部" %}It will output an array object containing filtering parameters (filters), each parameter contains its name (Name), field name (FieldName)and a series of options(Items).Itemseach element contains oneLabel(display text of the filtered value) andLink(URL to jump after clicking the filter). TheseLabelThe text directly originates from the 'default value' you set in the content model custom field or the specific value you select during content entry.
Combining challenges and strategies: implementing multilingual filtering conditions
English now we return to the core issue: how to makearchiveFiltersDo you provide language filtering? Considering that AnQiCMS does not automatically translate custom content, we need to adopt some strategies to compensate for this.
The core of the challenge lies in: archiveFilterstag outputLabelThis is based on the preset values in the content model or the actual values filled in the content. These values are not keys in the multilingual dictionary, and the system cannot translate them automatically into the current website language.
The following are several feasible strategies, each with its own advantages and disadvantages, suitable for different scenarios:
1. Independent management of multi-site/multi-language instances (recommended for strict separation)
If your business has very high requirements for the independence of multilingual content and filtering, and has sufficient budget and management resources, the most direct and thorough way is to set up an independent AnQiCMS site instance for each language, or use the multi-site management function of AnQiCMS to create an independent sub-site for each language.
- Advantages:Each site's content, filtering conditions, and even custom fields can be fully independently configured, without interference, and with clear management.
- Disadvantages:Increased operation 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 default values of custom fields and their filter options in the content model according to the needs of the language.For example, the English site is configured as “Apartment”、“Villa”, and the Chinese site is configured as “公寓”、“别墅”.
archiveFiltersTags will naturally display the filtering conditions of the current site language.
2. Utilizing within a single sitetrLabel translation for front-end (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, and then use the translation tags of AnQiCMStrConvert and display on the front end.
- Implementation steps:
- Custom field definition of content model:Define custom fields in the content model (for example
PropertyType),and set the default filter options for it. These values should use a uniform "key" or master language (such as "Apartment", "House"). - Content Entry:When publishing documents, select or fill in the corresponding (primary language) values for these custom fields.
- Language Package Configuration:Create under your template directory:
localesfolders under the template directory and configure the corresponding for each languagedefault.ymlFile. In thisymlIn the file, match all the filter value keys (such as “Apartment”) with their translations in different languages
- Custom field definition of content model:Define custom fields in the content model (for example