As an experienced website operations expert, I know that every detail in user experience and website customization can affect visitor retention and conversion.AnQiCMS (AnQiCMS) provides us with powerful content management capabilities with its excellent flexibility.archiveFiltersThe default 'All' option in the tag.

In the operation, the filtering function of the website is a key to improve user navigation efficiency and accurate content positioning. It is from Anqi CMS.archiveFiltersThe tag is born for this, it allows us to generate dynamic filtering conditions based on various parameters of the document (such as product attributes, article types, etc.)When a user is faced with a bunch of filtering conditions, an 'All' option is usually essential, representing the default state when no filtering conditions are applied.However, in some scenarios, we may need to adjust the display text of this "All" to better fit the brand tone or simply hide it to optimize specific user interactions.

UnderstandingarchiveFiltersTags and their 'All' option

archiveFiltersThe tag is mainly used to build filters on document list pages or category pages.Imagine an e-commerce website where users can filter products by color, size, brand, etc., or a content portal where users can filter articles by article type, publishing year, etc.allTextParameter control.

Its basic usage is roughly as follows:

{# 在文档列表页或分类页中使用,moduleId指定内容模型,allText设置“全部”选项的文本 #}
{% archiveFilters filters with moduleId="1" allText="全部" %}
    {% for item in filters %}
    <ul>
        <li>{{ item.Name }}: </li> {# 筛选参数的名称,例如“颜色” #}
        {% for val in item.Items %}
        <li class="{% if val.IsCurrent %}active{% endif %}">
            <a href="{{ val.Link }}">{{ val.Label }}</a> {# 筛选值,例如“红色”、“蓝色” #}
        </li>
        {% endfor %}
    </ul>
    {% endfor %}
{% endarchiveFilters %}

In the above code,allText="全部"It is the core we need to focus on today. It defines the display text for the option representing no specific value selected under each filter parameter (such as "color

Custom text for the 'All' option display

The design philosophy of AnQi CMS is highly customizable, even for a seemingly fixed text, it provides us with an easy way to modify it. To customizearchiveFiltersUse the display text of the "All" option in the labelallTextassign the parameter to the new text you want to display.

For example, if you find that the word 'All' is not vivid enough on your website, or you want to use more specific words to guide users, such as changing 'All Colors' to 'No Limit Colors', or 'All Types' to 'All Articles', you can simply modify itallTextJust value.

Let's see an example:

{# 将“全部”选项的文本改为“所有内容” #}
{% archiveFilters filters with moduleId="1" allText="所有内容" %}
    {% for item in filters %}
    <ul>
        <li>{{ item.Name }}: </li>
        {% for val in item.Items %}
        <li class="{% if val.IsCurrent %}active{% endif %}">
            <a href="{{ val.Link }}">{{ val.Label }}</a>
        </li>
        {% endfor %}
    </ul>
    {% endfor %}
{% endarchiveFilters %}

Modify it this wayallTextThe parameter value is "All Content", and the "All" option for all filtering parameters on the front-end page will be displayed as "All Content".This flexibility allows us to make fine adjustments according to the overall style of the website and the language habits of the target user group, thereby enhancing the consistency and affinity of the user experience.

Hide the 'All' option

If you don't want to display the 'All' option, justallTextThe parameter value is set tofalse. The system will automatically ignore this option during rendering and it will not be displayed on the front-end page.

The following is an example code to hide the "All" option.

{# 完全隐藏“全部”选项 #}
{% archiveFilters filters with moduleId="1" allText=false %}
    {% for item in filters %}
    <ul>
        <li>{{ item.Name }}: </li>
        {% for val in item.Items %}
        <li class="{% if val.IsCurrent %}active{% endif %}">
            <a href="{{ val.Link }}">{{ val.Label }}</a>
        </li>
        {% endfor %}
    </ul>
    {% endfor %}
{% endarchiveFilters %}

toallTextis set tofalseAfter that, no option indicating 'All' will appear under each filtering parameter.This approach is suitable for scenarios where filtering status is managed through other mechanisms (such as the first filter tag being the default 'No limit' state, or a clear 'Clear Filter' button being provided on the page), which helps simplify the interface and provide a more intuitive operation process.

Consideration for practical application

There are a few points to note when making these changes:

  1. Testing comes first:Any modifications to the template code are recommended to be made in the test environment, ensuring that the changes meet expectations and do not introduce new issues.
  2. User Experience:No matter whether you choose to customize the text or hide the "All" option, the core purpose is to optimize the user experience.Before making a decision, consider your target user's habits and the overall interaction logic of the website.
  3. Template File:These modifications usually need to be made in your theme template file located in/templatethe directory, usually the model list page or category page of.htmlPerform in the file. Make sure to modify the template you are currently using and backup the original file as a good habit.

Of Security CMSarchiveFilterslabel'sallTextA parameter provides a powerful and flexible control point that allows us to easily customize the filtering function.It can well meet our operational needs, whether it is to make the text more guiding or to make the interface simpler.


Frequently Asked Questions (FAQ)

  1. If I do not setallTextthe parameter, what text will be displayed by default?IfallTextThe parameter is not explicitly set, Anqi CMS will display the default 'All' text according to its internal conventions.As a rule, this default text is 'all'.allTextParameter, even if it is only used to use the default "All" text, this can enhance the readability and maintainability of the code, and avoid uncertainties that may arise from future system updates.

  2. Can I customize the 'All' option for a specific filter (such as the 'Color' filter) while keeping other filters default or hidden? archiveFilterslabel'sallTextThe parameter affects all the filtering parameters output by this tag. This means you cannot directly pass throughallTextParameters to customize a single filter. If you have such a refined need, you may need to combine with front-end JavaScript code, inarchiveFiltersAfter the label output is completed, modify or hide the text of specific HTML elements. Alternatively, consider writing a separate HTML structure for filters that require special handling when designing the template, without usingarchiveFiltersOutput uniformly.

  3. How can users clear the applied filter conditions after hiding the 'All' option?When you choose to hide the "All" option, it is essential to provide an alternative filtering clearing mechanism on the website front-end.The most common practice is to provide a 'reset filter' or 'clear all filters' button.Clicking this button should take the website back to a state where no filters have been applied (i.e., all filters are equivalent to the "All