In website content operation, the organization and retrieval efficiency of content is the key to improving user experience and SEO performance.Especially for sites with diverse content (such as articles, products, events, etc.), how to flexibly filter and display these contents has become a common challenge for operators and template developers.AnQiCMS as a system focused on providing efficient and customizable content management solutions, its powerful template tag system is the tool that solves this problem.archiveFiltersTagsmoduleIdParameter, understand its specific meaning and how to correctly specify it to filter the content of a specific model.

archiveFiltersTag: the foundation of dynamic content filtering.

Firstly, let's understand it.archiveFiltersTag itself. In AnQiCMS,archiveFiltersTags are designed to generate dynamic content filtering conditions.Imagine that your website has a 'Real Estate' section, where users may want to search for listings based on 'Property Type' (Residential, Commercial, Apartment), 'Unit Type' (1-Bedroom, 2-Bedroom), or 'Area'.archiveFiltersIt is used to build these filter options. It is usually applied to the document homepage or category page, along with the document pagination list (archiveListLabel) used in conjunction, provides the user with an interactive filtering interface.

When you use a template{% archiveFilters filters with ... %}This structure, AnQiCMS will dynamically generate a series of filter groups and filter values based on the parameters you provide.These filter groups and values will be rendered as clickable links. Each time a link is clicked, the page URL will be appended with the corresponding query parameters, thereby achieving precise content filtering.

moduleIdParameter: Lock the core filtering target.

Now, let's focus our attention on.archiveFiltersOne of the core parameters of the label -moduleIdWhat does this parameter specifically refer to?

In short,moduleIdThe parameter is used toClearly specify the unique identifier (ID) of the "content model" you want to filter content by.

In AnQiCMS, 'Content Model' is a very important concept.It allows you to customize the structure of content based on business requirements.For example, you can define an 'article model' to manage blog posts, which may include fields such as 'author', 'publish date', etc.; you can also define a 'product model' to manage product information, which may include fields such as 'price', 'stock', 'brand', etc.Each content model can have its own unique set of fields, including those custom fields marked as 'filterable' in the background.

When you usearchiveFiltersWhen labeling, AnQiCMS needs to know which type of content model it should target to generate filtering conditions.Is this a custom field for 'article' or for 'product'?moduleIdThe parameter acts as a 'baton', clearly telling AnQiCMS: 'Please generate a filter for the content model with ID X!'

How to specify correctlymoduleId?

Correct specificationmoduleIdIt is the key to ensure that the filtering function works properly. Here are some common situations and ways to obtainmoduleIdmethods:

  1. Built-in content model:AnQiCMS usually comes with some built-in basic content models, such as the 'article model' and the 'product model'. By convention, the IDs of these models are typically fixed:

    • Article Model:moduleId="1"
    • Product Model:moduleId="2"In most cases, if you want to filter articles or products, you can directly use these two IDs.
  2. Custom Content Model:If you have created a custom content model (such as 'Property Model', 'Job Position Model') in the AnQiCMS backend, each custom model will have a unique numeric ID. To find these IDs, you need:

    • Log in to the AnQiCMS admin panel.
    • Navigate to the 'Content Model' page under 'Content Management'.
    • Here, you will see the list of all defined content models, each displaying its corresponding ID. For example, the ID of the 'Property Model' might be3Then you will need to usemoduleId="3".

Once you have determined the ID of the target content model, you can assign its value toarchiveFiltersTagsmoduleIdParameter.

Example code parsing:

Let's take a look at the example code provided in the document and understand it withmoduleId:

{# 参数筛选代码 #}
<div>
    <div>参数筛选:</div>
    {% 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 %}
</div>

In this example,moduleId="1"clearly inform AnQiCMS, this filter shouldbe aimed at the "article model"Generate filtering conditions. AnQiCMS will search for all custom fields set as filterable under the "Article Model" and generate corresponding ones.item(Filter groups, such as "Categoriesitemunderval(Filter values, such as "Technology

Every oneval.Linkwill include a URL pointing to the current page, with the corresponding query parameters, such as?article_type=科技. When the user clicks this link, the page will reload, andarchiveListTags will automatically detect the URL in thearticle_typeparameters, and then only display articles with the "Article Type" set to "Science and Technology".

moduleIdwith content operation strategy

correctly utilizemoduleIdParameters, which can greatly enhance the flexibility of website content operation and user experience:

  • Precise filtering:Provide customized filtering conditions for specific content models to help users quickly find the information they need, such as displaying product-related filters (color, size) on the product page, rather than article-related filters (author, category).
  • Optimize navigation: Combine URL parameters to implement SEO-friendly URL structure, enhancing the search engine's ability to crawl deep content.
  • Improve conversion:Simplify the user decision path, improve user interaction efficiency within the site, and indirectly enhance content consumption and conversion rates.

PassmoduleIdParameters, you can abstract the complex content filtering logic and implement it in a concise and efficient way at the template level, giving full play to the powerful content model of AnQiCMS.


Common Questions (FAQ)

Q1:moduleIdWhat is the value of the parameter, the model name, table name, or URL alias? Where can I check its exact value?

moduleIdThe value of the parameter is aDigital IDInstead of the model name, table name, or URL alias.You can find the 'Content Model' page under the 'Content Management' menu in the AnQiCMS backend. Each content model will clearly display its corresponding numeric ID.For example, the article model is typically ID 1, the product model is typically ID 2, and the custom model you create will have its own unique numeric ID.

Q2: I setmoduleIdBut the filter did not display any options, why is that?

Even if you specify it correctly,moduleIdif the content model is under,No custom fields have been defined, or the defined custom fields have not been set as 'filterable',archiveFiltersTags will not generate any filter options. Please check if you have added a filterable custom field for this model in the 'Content Model' settings of AnQiCMS backend.

Q3:archiveFiltersCan the tag be used on any page of the website?

archiveFiltersThe tag is mainly designed forDocument list page or category pageIt depends on the current page context to identify the filtering content, and is usually used witharchiveListtags to be used after the user clicks the filtering options,archiveListCan reload and display filtered content based on query parameters in the URL. In non