As an experienced website operations expert, I am happy to delve into AnQiCMS for youtagDataListThe function of filtering tags by content model.In today's increasingly refined content operation, being able to flexibly organize and present 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.
Deep 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.Content models give us the ability to define structures for different types of content, such as articles, products, cases, etc.; tags provide a flexible horizontal association mechanism, allowing content under different models to be linked together through common keywords or themes.Then, when we want to accurately display a specific document model in a tab, can AnQiCMS meet this need?The answer is affirmative.
AnQiCMStagDataListLabel, as the core tool used to call the document list under a specific label in the template system, indeed supports filtering by content model.This brings great flexibility and accuracy to content operation.
Understanding the Role of Content Models and Tags in AnQiCMS
The core advantage of AnQiCMS lies in its flexible content model function.It allows you to customize the structure of content based on business requirements.For example, a blog website may need an 'article' model, including title, author, content, publish date, etc.; an e-commerce website may need a 'product' model, including product name, price, inventory, image set, etc.This custom capability allows AnQiCMS to adapt to various complex business scenarios, making your content management more organized.
The label (Tag) is another powerful dimension for content organization and retrieval.标签能够跨越分类和内容模型的限制,将具有相似主题或关键词的内容聚合起来。For example, a tag about 'AI technology' can link to multiple articles in the technology blog, as well as to the AI product introduction page in the product catalog, and even to the dynamic updates about AI mentioned in the company news.
tagDataListThe core function and content-based model filtering
tagDataListTags are used in the AnQiCMS template system to call and display document lists associated with specific tags. Their basic usage is based ontagIdGet all documents under a specific tag.However, in actual operation, we often encounter such a scenario: in a tab named “AI Technology”, we may wish to display only the “article” model content related to the label in one area of the page, while displaying the related “product” model content in another area.tagIdIt is not possible to distinguish the content model to which these documents belong.
The core of realizing this refined filtering function lies intagDataListtag provides a name ofmoduleIdThe parameter.
By setting amoduleIdSpecify the corresponding content model ID, and you can accurately controltagDataListThe document returned only belongs to the specific content model.This means, you can easily distinguish and display all content under the "AI technology" tag, according to its content model (such as articles, products, services, etc.).
For example, assume your 'article' model ID is1while the 'product' model ID is2If you want to list related articles and products under the 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 specify the label by calling it twicetagDataListrespectivelymoduleId="1"(article model) andmoduleId="2"(Product Model),thus achieving the purpose of accurately filtering and displaying different types of documents under the same label based on content model.
ExceptmoduleId,tagDataListIt also supports other useful parameters, such astagId(Specified Tag ID)、limit(Limited Display Quantity)、order(Sorting Method, such as by ID, views, etc.)、type(List Type, supports pagination) as well assiteId(Specify site data in a multi-site environment). The combination of these parameters can help you build highly customized and feature-rich label content pages.
Actual application and operation value
This feature has significant value in actual content operation:
- Accurate content display:The content type that best matches the user's current needs is displayed in a specific page area, improving the accuracy of information matching.
- Optimize 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:Through model filtering, targeted tag aggregation pages can be created for different content models, which helps search engines better understand page content and optimize keyword rankings.
- Flexible operational strategies:Allow operational personnel to flexibly adjust the display weight and layout of various contents in the tabs based on market feedback or business priorities, without modifying the underlying content data.
Summary
In summary, AnQiCMS'stagDataListLabel passed by introducingmoduleIdParameters, provide strong capabilities for content operation personnel to filter label documents by content model.This not only reflects the flexibility advantage of AnQiCMS in content management, but also lays a solid foundation for building a more intelligent, personalized, and efficient website content structure.Flexible use of this feature will greatly enhance your website's content management efficiency and user interaction experience.
Common Questions (FAQ)
How can I know the specific ID of my content model?You can enter the 'Content Model' module under 'Content Management' in the AnQiCMS backend management interface.Here, you can view the list of all created content models, each with a unique ID.The default ID is usually assigned to both the 'Article Model' and the 'Product Model', and your custom model will also have a corresponding ID.
tagDataListCan I press multiple keys at the same time?moduleIdFiltering?According to the current documentation of AnQiCMS,moduleIdThe parameter is designed to accept a single content model ID. If you need to display label documents under multiple content models at the same time but also want to distinguish them, it is recommended that you do as shown in the article example, separate