How to filter and display documents of a specific content model in the document list?

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 manage various content forms, whether it's articles, product details, or event announcements, all can be fine-tuned and displayed.

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 required content 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, the content model is like a 'skeleton' tailored to different types of content.For example, your website may need to publish blog articles as well as display product information.The article may require fields such as 'publish date', 'author', etc., while the product may require fields such as 'price', 'stock', 'product image set', etc.Through content models, you can define a set of exclusive field structures for each type of content, ensuring the standardization of content entry and the personalization of display.

By default, AnQiCMS comes built-in with the "article model" and the "product model".Of course, you can also easily create and customize more exclusive content models according to your business needs, significantly enhancing the adaptability of the system.

In the background document list, filter documents of specific content models

To quickly find the document of a specific content model in the background, the operation is very intuitive. This is an essential function for daily content auditing, editing, or management work.

First, you need to log in to the AnQiCMS backend, navigate to the "Content Management

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 light tap, select the specific content model you want to view (such as "Article Model" or the "Activity Model" you customize).The document list will be updated in real time, only displaying documents belonging to the content model.

In addition to content model filtering, you can also combine 'Document Title' and 'Category' and other filtering conditions to further narrow down the scope and accurately locate the document you need.This multi-screening mechanism makes backend management efficient and convenient.

On the website front end, display specific content model documents accurately

Filtering specific content models is not only for the convenience of backend management, but more importantly, it can accurately display different types of content on the website frontend.For example, you may want to display the latest articles and popular products in different areas of the homepage, or only show specific types of content on certain pages.

AnQiCMS's template system provides a namedarchiveListpowerful tag, allowing you to flexibly achieve this requirement.

To implement content model display,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 may be2While 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 backend.

If you want to display the latest 5 "product models" 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 namedproductsto store the query results.
  • moduleId="2":Key parameters indicating that the system should only query the content model with ID 2 (assuming this is the product model).
  • type="list":Means to display in list form without pagination.
  • limit="5":Restricts the display to 5 documents.
  • order="id desc":Sort by ID in descending order, that is, display the latest released 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(Sort method, such as by views, publication time),type="page"(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 function of AnQiCMS brings great flexibility and convenience to website content management. Whether it is to efficiently filter through the "Document Management" interface in the backend, or to utilizearchiveListThe template tags present specific types of content accurately on the front end, making content operation work more convenient.Make good use of these features, and your website content will be more organized, and the user experience will also be significantly improved.


Common Questions and Answers (FAQ)

1. Why doesn't the custom content model and document I created show up in the document list when I filter?通常,新创建的文档需要关联到一个具体的“分类”,而这个分类本身也必须是基于您创建的“内容模型”。Please ensure that your document is selected with the correct category, and that category exists in the backend "Content Management" -> "Document Categories

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 times.archiveListLabel, specifying a different one each timemoduleIdParameters 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 models.moduleId="2"ofarchiveListto display the product, thus achieving a mixed display of multiple content models.

3. How to know the content model corresponding to my contentmoduleIdWhat is it?To view your content modelmoduleIdPlease login 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.archiveListthe label usemoduleIdThe value that needs to be filled in when setting the parameters.