Does AnQiCMS's Tag document list (`tagDataList`) support filtering by content model?

As an experienced website operation expert, I am more than willing to deeply analyze AnQiCMS in detailtagDataListThe function of filtering tags by content model. In today's increasingly refined content operation, being able to flexibly organize and display content is the key to improving user experience and optimizing SEO.AnQiCMS in this aspect, with its powerful content model and tag management functions, provides us with many conveniences.


In-depth analysis: AnQiCMS Tag document listtagDataListHow to implement content model filtering

In the powerful content management system of AnQiCMS, tags (Tag) and content models (Content Model) play a crucial role.The content model gives us the ability to define structures for different types of content, such as articles, products, cases, etc.And tags provide a flexible horizontal linkage mechanism, allowing content under different models to be linked together through common keywords or themes.So, when we want to accurately display a specific content model document in a tab, can AnQiCMS meet this requirement?The answer is affirmative.

AnQiCMS'tagDataListTags, as the core tool used to call the document list under a specific tag in the template system, indeed supports filtering by content model.This brings great flexibility and accuracy to content operation.

Understanding the role of content model and tags in AnQiCMS

One of AnQiCMS's core advantages lies in its flexible content model feature.It allows you to customize the structure of content according to your business needs. For example, a blog website may need an "article" model, including title, author, content, publication date, and other fields;An e-commerce website may need a "product" model, which includes product name, price, inventory, image set, etc.This custom ability allows AnQiCMS to adapt to various complex business scenarios, making your content management more organized.

And tags (Tag) are another powerful dimension for content organization and retrieval.Tags can cross the limitations of hierarchical categories and content models, aggregating content with similar themes or keywords.For example, a tag about "AI technology" can be associated with multiple articles in a technical blog, as well as the AI product introduction page in the product catalog, and even linked to company news mentioning AI dynamics.

tagDataListCore function and content model filtering

tagDataListTags are in the AnQiCMS template system, specifically used to call and display document lists associated with a specific tag. Its basic usage is based ontagIdTo get all documents under a specific tag. However, in actual operation, we often encounter such scenarios: in a tab named "AI Technology", we may want to only display the "article" model content related to the tag in one area of the page, and display the related "product" model content in another area.At this moment, only bytagIdCannot distinguish the content model to which these documents belong.

The core of realizing this refined filtering function lies intagDataListthe label provides a namedmoduleIdthe parameter.

By usingmoduleIdSpecify the corresponding content model ID, you can accurately control it.tagDataListThe document returned only belongs to the specific content model.This means, you can easily distinguish and display all contents belonging to the 'AI Technology' tag, according to their content models (such as articles, products, services, etc.)

For example, assuming your "article" model ID is1while the "product" model ID is2. If you want to list the relevant articles and products in a tab named "AI Technology", you can write the code in the template like this:

{# 假设当前页面的Tag ID已自动获取,或者您通过其他方式获取了Tag ID #}
{# 示例中,我们用“当前Tag的ID”来表示 #}

<h3>AI技术相关的文章</h3>
{# 调用当前标签下,所有“文章”模型的文档 #}
{% tagDataList articlesByTag with tagId="当前Tag的ID" moduleId="1" type="list" limit="10" %}
    {% for item in articlesByTag %}
        <div class="article-item">
            <h4><a href="{{ item.Link }}">{{ item.Title }}</a></h4>
            <p>{{ item.Description|truncatechars:100 }}</p>
            <span>发布日期:{{ stampToDate(item.CreatedTime, "2006-01-02") }}</span>
        </div>
    {% empty %}
        <p>暂无AI技术相关的文章。</p>
    {% endfor %}
{% endtagDataList %}

<hr>

<h3>AI技术相关产品</h3>
{# 调用当前标签下,所有“产品”模型的文档 #}
{% tagDataList productsByTag with tagId="当前Tag的ID" moduleId="2" type="list" limit="8" %}
    {% for item in productsByTag %}
        <div class="product-item">
            <a href="{{ item.Link }}">
                <img src="{{ item.Thumb }}" alt="{{ item.Title }}" />
                <h5>{{ item.Title }}</h5>
            </a>
            <span class="price">¥ {{ item.Price }}</span>
        </div>
    {% empty %}
        <p>暂无AI技术相关产品。</p>
    {% endfor %}
{% endtagDataList %}

In this code, we make two calls totagDataListtags to specifymoduleId="1"(article model) andmoduleId="2"(Product model), thus achieving the purpose of accurately filtering and displaying different types of documents under the same label.

exceptmoduleId,tagDataListAlso supports other useful parameters such astagId(Specify Tag ID,)limit(Limit Display Quantity,)order(Sorting Method, such as by ID, views, etc.,)type(List Type, supports pagination) as wellsiteIdSpecify site data in a multi-site environment). The combination of these parameters can help you build highly customized, feature-rich label content pages.

practical application and operation value

This feature has a significant value in practical content operation:

  • Accurate content display:Can only display the content type that best meets the user's current needs in a specific page area, improving the accuracy of information matching.
  • Optimizing user experience: Users can clearly see the distinction between different content models while browsing tabs, quickly locate the required information, and reduce search costs.
  • Enhance SEO structure:By filtering the model, you can create more targeted tag aggregation pages for different content models, which helps search engines better understand the content of the page and optimize keyword rankings.
  • Flexible operational strategy:Allow operation personnel to flexibly adjust the display weight and layout of various contents on the tab page according to market feedback or business focus, without changing the underlying content data.

Summary

In summary, AnQiCMS'stagDataListTag through introductionmoduleIdParameters provide strong capabilities for content operators to filter label documents according to the content model.This not only reflects the advantages of AnQiCMS in content management flexibility, but also lays a solid foundation for building a more intelligent, personalized, and efficient website content structure.Flexibly utilizing this feature will greatly enhance your website content management efficiency and user interaction experience.


Frequently Asked Questions (FAQ)

  1. How can I know the specific ID of my content model?You can go to the AnQiCMS backend management interface, enter the "Content Management" module under "Content Model".Here, you can view the list of all content models created, each model will have a unique ID identifier.As a rule, both the 'Article Model' and the 'Product Model' have a default ID, and the custom model you define will also have the corresponding ID.

  2. tagDataListCan I press multiple keys at the same timemoduleIdto filter?According to the current AnQiCMS documentation,moduleIdThe parameter is designed to accept a single content model ID. If you need to display tag documents under multiple content models at the same time but also want to distinguish them, it is recommended that you do so like in the article example, divide