What does the `archiveFilters` tag's `moduleId` parameter specifically refer to? How should it be properly specified to filter a specific model?

Calendar 👁️ 54

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 is a system focused on providing efficient, customizable content management solutions, and its powerful template tag system is the tool to solve this problem.Today, we will delve deeply into a crucial component of the AnQiCMS template tags-archiveFilterslabel'smoduleIdParameters, understand its specific meaning and how to correctly specify it to filter the content of a specific model.

archiveFiltersTags: the foundation of dynamic content filtering.

First, let's understandarchiveFiltersTags themselves. 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), "Layout" (one-bedroom, two-bedroom) or "Area".archiveFiltersIt is used to build these filtering options. It is usually applied to the document homepage or category page, along with the document pagination listarchiveListTags used together to provide users with an interactive filtering interface.

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

moduleIdParameter: Lock the core filtering target

Now, let's focus our attention onarchiveFiltersone of the core parameters of the tag -moduleIdWhat does this parameter specifically refer to?

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

In AnQiCMS, the '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", "inventory", "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 generate filtering conditions for.Is it a custom field for 'article' or for 'product'?moduleIdThe parameter plays the role of a 'baton', clearly telling AnQiCMS: "Please generate a filter for the content model with ID X!"

How to specify correctlymoduleId?

Specify correctlymoduleIdIt is the key to ensure that the filter function works normally. The following are some common situations and how to obtainmoduleIdmethods:

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

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

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

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

Example code parsing:

Let's take a look at the example code provided in the document and combinemoduleIdfor understanding:

{# 参数筛选代码 #}
<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"Make it clear to AnQiCMS that this filter shouldTarget the 'Article Model'Generate filter conditions. AnQiCMS will find all custom fields set as filterable under the "Article Model" and generate the correspondingitem(Filter group, such as "Category", "Tag", or custom "Article Type" for the article model), as well as eachitembelowval(Filter values, such as "Technology", "Sports", etc).

Every oneval.Linkwill include a URL pointing to the current page, with the corresponding query parameters, for example?article_type=科技. When the user clicks on this link, the page will reload andarchiveListThe tag automatically detects the URL inarticle_typethe parameters, then only displays articles with the type "Science".

moduleIdContent operation strategy

Utilize correctlymoduleIdParameters can greatly enhance the flexibility of website content operations and user experience:

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

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


Frequently Asked Questions (FAQ)

Q1:moduleIdThe value is the model name, table name, or URL alias? Where should I look up its exact value?

moduleIdThe value is anumeric 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, where each content model will clearly display its corresponding numeric ID.For example, the article model is usually ID 1, the product model is usually ID 2, and the custom model you create will have its own unique numeric ID.

Q2: I have setmoduleIdBut why doesn't the filter show any options?

Even if you specify it correctlymoduleIdIf the content model is underThere is no custom field defined, or the defined custom field has not been set as 'filterable',archiveFiltersThe label will not generate any filter options. Please check if you have added a filterable custom field for this model in the AnQiCMS backend settings.

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

archiveFiltersThe tag is mainly designed forDocument list page or category page. It depends on the current page context to identify the filtered content and usually needs to be associated witharchiveListUse tags together so that after the user clicks the filter option,archiveListthe content filtered by the query parameters in the URL can be reloaded and displayed. In non

Related articles

How to configure document model parameters in AnQi CMS backend for `archiveFilters` tag filtering?

In the vast sky of AnQi CMS, content operation experts often face a challenge: how to allow users to easily and quickly find the information they need?Especially when the structure of a website's content is complex, such as e-commerce products, real estate information, or various categorized articles, a flexible and efficient filtering mechanism becomes particularly important.Today, we will delve into how Anqi CMS can work in synergy with the powerful `archiveFilters` tag by cleverly configuring document model parameters to create a personalized content filtering feature for your website.

2025-11-06

How do the `archiveFilters` tag and `archiveList` and `pagination` tags work together to build a complete filter page?

AnQiCMS as an efficient and customizable enterprise-level content management system provides powerful template tag support when building a feature-rich website.Among these three tags, `archiveFilters`, `archiveList`, and `pagination` work together to help us easily build a user-friendly filtering page that allows visitors to quickly locate the content they need.

2025-11-06

How to understand the `archiveFilters` tag in the "document parameter filtering" function of the AnQi CMS template?

As an experienced website operations expert, I am well aware that how to efficiently organize and present information in an increasingly complex content ecosystem, while ensuring that users can easily find the content they need, is the key to enhancing the value of the website.AnQiCMS (AnQiCMS) with its flexible content model and powerful template system, has provided us with many tools to achieve this goal, among which the `archiveFilters` tag is undoubtedly a powerful tool for creating advanced content filtering functions. Today

2025-11-06

What content filtering needs are addressed by the `archiveFilters` tag in AnQi CMS?

As an experienced website operations expert, I know that how to help users efficiently find the information they truly need in the vast ocean of content is the key to improving user experience and website value.AnQiCMS (AnQiCMS) excels in content management, and the `archiveFilters` tag it provides is an important tool for solving this core content filtering need.In today's content-centric era, whether it is a corporate website, e-commerce platform, or vertical industry portal, the amount of content carried by the website is increasingly large.

2025-11-06

How to customize the display text of the 'All' option in the `archiveFilters` tag or hide it?

As an experienced website operation expert, I am well aware that every detail in user experience and website customization may affect visitor retention and conversion.AnQiCMS (AnQiCMS) with its excellent flexibility, provides us with powerful content management capabilities.Today, let's delve into a common problem in front-end filtering functionality: how to elegantly customize or hide the default 'All' option in the `archiveFilters` tag.

2025-11-06

What is the structure of the `archiveFilters` tag returned `filters` variable? How to traverse the data within it?

AnQi CMS is an efficient and customizable enterprise-level content management system, playing a vital role in the content operation field.It not only provides powerful content publishing and management capabilities, but also through a series of flexible template tags, gives the website a high degree of customization and interactivity.Today, let's delve into one of the very practical tags - `archiveFilters`, and how it helps users accurately locate content in vast amounts, thereby significantly improving the user experience and content discovery efficiency of the website.

2025-11-06

What do the `Name` and `FieldName` fields represent in the `filters` variable? How are they used in the template?

As an experienced website operations expert, I have a deep understanding of the importance of efficient and flexible template usage in content management systems (CMS) for website operations efficiency and user experience.AnQiCMS (AnQiCMS) offers us powerful content operation tools with its concise and efficient characteristics, especially its flexible template tag system, making content display as easy as pie.

2025-11-06

The `archiveFilters` tag generates each filter option (`Items`) and includes which available fields, such as `Label`, `Link`, `IsCurrent`?

As an experienced website operations expert, I deeply understand the importance of content organization and user experience for the success of a website.AnQiCMS (AnQiCMS) with its powerful content management and flexible template customization capabilities has become my powerful assistant in efficiently operating my website.Today, let's delve into the `archiveFilters` tag, especially the key fields included in each filter option (`Items`), which are the foundation for refined content filtering and optimizing user experience.

2025-11-06