In website operation, efficiently managing and displaying different types of content is the key to improving user experience and work efficiency.AnQiCMS (AnQiCMS) with its flexible content model design, allows you to easily handle various content forms, whether it's articles, product details, or event announcements, and can be managed and displayed with precision.
Today, let's delve into how to efficiently filter and display documents of specific content models in AnQiCMS.This can not only help you quickly locate the content you need in the background, but also make your website's frontend content display more accurate and dynamic.
Understanding the content model of AnQiCMS
One of the core highlights of AnQiCMS is its flexible and variable content model.In simple terms, a content model is like a 'skeleton' customized for different types of content.For example, your website may need to publish blog articles as well as display product information.The article may need fields such as "publish date", "author", while products may need fields such as "price", "inventory", "product image group", etc.By using the content model, you can define a unique field structure for each type of content, ensuring the standardization of content entry and the personalization of display.
By default, AnQiCMS is built-in with "article model" and "product model".Of course, you can also easily create and customize more exclusive content models according to your business needs, greatly enhancing the adaptability of the system.
Filter documents of a specific content model in the background document list
Want to quickly find the document of a specific content model in the background? It is very intuitive to operate. This is an indispensable function for daily content auditing, editing, or management work.
First, you need to log in to the AnQiCMS backend, navigate to the left menu's 'Content Management', and then click 'Document Management'. Here, all documents on your website will be listed.
At the top of the document list interface, you will see a dropdown menu named "Content Model Filter".This menu is your key tool. Just a tap, choose the specific content model you want to view (such as "article model" or your custom "event model").The document list will be updated immediately, only showing all documents belonging to the content model.
In addition to content model filtering, you can also combine filtering conditions such as 'document title' and 'category' to further narrow down the range and accurately locate the document you need.This multi-filtering mechanism makes back-end management efficient and convenient.
Display specific content model documents accurately on the website front-end
Filtering specific content models is not just for the convenience of backend management, but more importantly, it can accurately display different types of content on the website front end.For example, you may want to display the latest articles and popular products in different areas of the homepage, or only show a specific type of content on certain pages.
AnQiCMS template system provides a namedarchiveListpowerful tag, allowing you to flexibly meet this need.
To implement the display according to the content model,moduleIdThe parameter is your core. Each content model in the system has a unique ID. For example, the article model usually corresponds to an ID such as1, the product model could be2And the custom model you create will also have its corresponding ID. You can view the specific ID of each model in the "Content Management" -> "Content Model" section of the background.
Assuming you want to display the latest 5 "product model" documents on a page, you can write the template code like this:
{# 显示产品模型的最新5篇文档 #}
<div>
<h3>最新产品推荐</h3>
<ul>
{% archiveList products with moduleId="2" type="list" limit="5" order="id desc" %}
{% for item in products %}
<li>
<a href="{{item.Link}}">
<img src="{{item.Thumb}}" alt="{{item.Title}}" />
<h4>{{item.Title}}</h4>
</a>
</li>
{% empty %}
<li>暂无产品数据</li>
{% endfor %}
{% endarchiveList %}
</ul>
</div>
In this code block:
archiveList products: Declare a variable namedproductsThe variable is used to store the query results.moduleId="2": A critical parameter indicating that the system should only query the content model with ID 2 (assuming this is the product model).type="list": Indicates that it is displayed in list form without pagination.limit="5": Limits the display to 5 documents.order="id desc": Sort by ID in descending order, which displays the most recently published documents.
By adjustingmoduleIdvalue, you can easily switch to the content model you want to display. In addition,archiveListTags also supportcategoryId(Filter by category ID),order(Sorting method, such as by views, publication time),type="page"(Used for pagination display) and more parameters, allowing you to flexibly combine according to your actual needs, creating various complex dynamic content display effects.
Summary
The content model feature of AnQiCMS brings great flexibility and convenience to website content management. Whether it is through the efficient filtering of the "document management" interface in the background or by utilizingarchiveListThe template tags present specific types of content accurately on the front end, making content operations work more proficient.Make good use of these features, your website content will become more organized, and the user experience will be significantly improved.
Frequently Asked Questions (FAQ)
1. Why does not show in the document list when I created a custom content model and document?Generally, a newly created document needs to be associated with a specific 'category', and this category itself must be based on the 'content model' you create.Make sure your document has been selected with the correct category, and that category is in the background "Content Management" -> "Document Categories", with the "Document Model" matching your custom content model.
2. Can I display documents from different content models on the same page?Of course you can. You just need to use the template multiple timesarchiveListtags, specifying different ones each timemoduleIdThe parameter can be used. For example, you can place one at the top of the pagemoduleId="1"ofarchiveListto display the article, and then place one below to display the product, thus achieving a mixed display of multiple content modelsmoduleId="2"ofarchiveListto display the product, thus achieving a mixed display of multiple content models
3. How to know the corresponding of my content modelmoduleIdare?To view your content modelmoduleIdPlease log in to the AnQiCMS backend, navigate to the left menu's 'Content Management', and then click 'Content Model'.On the content model list page, each content model will display its unique ID.This ID is where you arearchiveListUsed in tagsmoduleIdThe value that needs to be filled in when checking the parameters.