How to customize the AnQiCMS content model to meet the display needs of different content types (such as articles, products)?

Calendar 👁️ 73

In today's rapidly changing digital world, website content is no longer just simple articles or product introductions.In order to accurately target users and improve conversion, we often need to tailor the display form and data structure of different types of content to fit.AnQiCMS (AnQi Content Management System) is well-versed in this, and the flexible content model function it provides is the powerful tool to solve this challenge.

Understanding the core value of the AnQiCMS content model

You may be running a corporate website, where you need to publish industry news, technical articles, and also showcase detailed product parameters and successful cases; or you may be a self-media creator, who needs to publish various contents such as event registration, course introduction, and daily blogs.If all this content is cramped into a fixed "article" or "product" template, not only will the publishing efficiency be low, but the front-end display will also be chaotic and disorganized, making it difficult to meet the refined needs of users.

This is the value of the content model.It is like designing a dedicated 'blueprint' for each type of content, specifying what fields it should contain and how the data should be stored.AnQiCMS provides this highly customizable capability, allowing you to create infinite possible content structures according to your business needs, thereby achieving personalized content display.This has greatly enhanced the flexibility of content management, and has also laid a solid foundation for the website's SEO optimization and user experience.

Create and modify content models manually

The AnQiCMS backend design is very intuitive, allowing you to easily manage and customize content models.

To start customization, you need to log in to the backend, find the "Content ManagementThe system is already built-in with 'Article Model' and 'Product Model', which are the most commonly used content types.You can choose to modify these built-in models, or create a brand new custom model according to your needs.

When creating or modifying a content model, there are several key settings that we need to pay attention to:

  • Model nameThis is the Chinese name you give to the content model, such as "News Dynamic", "Service Case", "Project Display", etc., which will be displayed directly in the background management interface and the breadcrumb navigation on the front page.
  • Model table nameThis is a very critical setting that determines the table name where the model's data is stored in the database, and it is also referenced in the template through this table name. Please make sure to useEnglish lowercase lettersEnsure that it is unique throughout the system, avoiding conflicts with other models or system tables.
  • URL alias: Also needs to be usedEnglish lowercase lettersThis alias will affect the URL structure of the front-end page, especially when you enable the pseudo-static rules and use{module}When a variable is involved, it comes into play. A clear, meaningful URL alias is helpful for SEO.
  • Title NameThis setting is very user-friendly, it will serve as the prompt text for the document title input box when publishing content.For example, if you created a "product model", you can set the title name to "product name", so that the operator will be clearer what to fill in when publishing the product.

The core of the custom content model lies in the "custom fields of the content model".This is where you define unique data properties for a specific content type.

  • Parameter NameThis is the Chinese name displayed on the background management interface, which is convenient for you and your team members to understand the purpose of the field.
  • Field invocationThis is the unique identifier you use when referencing this field in the front-end template.It must be in lowercase English letters.Clear and descriptive. This field name will directly determine how you obtain the corresponding data in the template.
  • Field type: AnQiCMS provides various field types to meet different data entry requirements:
    • Single-line text: Suitable for short text input, such as product models, article sources.
    • Number: Designed for numeric data types, such as product prices, inventory quantities.
    • Multi-line text: Used for longer text input, such as product descriptions, case details.
    • Single choice: Provide predefined options, the user can only select one, such as the "recommended level" of the article (headline, recommended, ordinary).
    • Multiple selections: Provide preset options, the user can select multiple, such as the color (red, blue, green) of the product.
    • Drop-down selection: Similar to single selection, but presented in a dropdown menu, saving page space.
  • Mandatory?: Can force users to fill in this field when publishing content.
  • Default valueSet an initial value for the field, especially when selecting class fields, here you need to enter one option per line, and the system will automatically parse it.

By combining these fields, you can build any content structure you want.For example, add fields such as "author", "source", "publishing media", and others to the "news dynamic" model; add fields such as "brand", "model", "material", and "size" to the "product display" model.

Display custom content in the front-end template.

Customized the content model, the next step is to present these rich data vividly on the front page.AnQiCMS's template system uses syntax similar to Django, allowing you to easily render backend data to the frontend.

On the content detail page (such as the article detail page or product detail page), you can use{% archiveDetail %}Label to get the various fields of the current content.For the fields you customize in the content model, you can directly obtain them through their 'call field'.authorthe calling field of (author), and it can be displayed in the template like this:{% archiveDetail with name="author" %}.

If you want to traverse all custom fields more flexibly, or want to dynamically display these parameters,{% archiveParams %}The tag comes into play. This tag will return an array containing all custom fields, each withNameand (parameter name)Value(Value). This is very useful for a general way to display "product parameters" or "service features".

For example, added 'price' and 'stock' fields to the product model, as well as a 'features' multi-choice field. On the product detail page, you can display it like this:

`twig

<h1>{% archiveDetail with name="Title" %}</h1>
<p>价格:{% archiveDetail with name="price" %}</p>
<p>库存:{% archiveDetail with name="stock" %}</p>

<h2>产品特性:</h2>
<ul>
{% archiveParams params %} {# 获取所有自定义参数 #}
    {% for item in params %}
        {# 假设“产品特性”的调用字段是“features” #}
        {% if item.FieldName == "features" %}
            {% set feature_list = item.Value|split:"," %} {# 多

Related articles

How to correctly use the double curly braces `{{}}` and percentage signs `{% %}` tags in AnQiCMS templates to control the display logic of content?

When using AnQiCMS to build and manage websites, flexibly using template language is the key to improving efficiency and achieving personalized display.Among them, the double curly braces `{{}}` and the percentage tags `{% %}` are two core 'roles' that control the display logic of template files.They each have different responsibilities, understanding and using them correctly can help you easily master the powerful template functions of AnQiCMS.

2025-11-08

How to enable Markdown editor in AnQiCMS and display mathematical formulas and flowcharts correctly?

Today, with the increasingly rich content creation, plain text is no longer sufficient to express complex concepts.If complex mathematical formulas in academic articles or clear process diagrams in project management can be presented intuitively on the web, it will undoubtedly greatly enhance the professionalism and user experience of the content.AnQiCMS (AnQiCMS) understands this need, through the built-in Markdown editor and flexible frontend configuration, allowing you to easily implement these advanced content displays.This article will give a detailed introduction on how to enable Markdown editor in AnQiCMS

2025-11-08

How does AnQiCMS call and display data for specific sites based on different site IDs?

AnQiCMS multi-site data call: easily achieve content sharing and linkage display AnQiCMS is a content management system designed specifically for small and medium-sized enterprises and content operation teams, and its multi-site management function is one of its core highlights.In actual operation, we often encounter such needs: the main station needs to display the latest products of various sub-sites, or all sub-sites need to uniformly display the contact information of the company's headquarters, or multiple content platforms hope to aggregate and display articles on a specific theme.In this case, how to efficiently call and display data from a specific site is particularly important

2025-11-08

How to add `hreflang` tags in AnQiCMS template for multilingual pages to optimize SEO?

In today's globalized internet environment, many websites need to provide content for audiences of different languages or regions.To ensure that these multilingual pages can be correctly understood and displayed by search engines, the `hreflang` tag plays a crucial role.It can tell search engines that your website has multiple language versions and which version should be displayed to which user.

2025-11-08

How to configure the pseudo-static rules in AnQiCMS to optimize the URL structure and improve the display of content in search engines?

The importance of URL structure in a content management system is self-evident.A clear, concise, and meaningful URL not only enhances user experience but is also a key factor in search engine optimization (SEO).In AnQiCMS, by carefully configuring the pseudo-static rules, we can transform those dynamic URLs that may have complex parameters into static forms, thereby allowing the website content to display better in search engines.Understanding URL Rewriting: Why It Is Crucial for Your Website?Imagine, a web page address is `www

2025-11-08

How to filter and display content according to different conditions (category, model, recommendation attributes) for the AnQiCMS document list tag `archiveList`?

When building a website with Anq CMS, flexibly displaying content is the key to achieving excellent user experience and efficient content management.Among them, the `archiveList` tag is undoubtedly the core tool for content display, which helps us filter and present articles, products, or other custom content model data according to various conditions.This article will delve into how the `archiveList` tag accurately filters and displays the content you want based on categories, content models, recommendation attributes, and other conditions.

2025-11-08

How to use AnQiCMS's `archiveDetail` tag to refine the acquisition and display of the detailed content and custom fields of a specified document?

In AnQiCMS, managing and displaying website content, the `archiveDetail` tag is undoubtedly one of the core tools.It allows us to delve into each specific document, whether it is an article, product, or other custom type, thus extracting and presenting its detailed information, even including those custom fields tailored to business needs.Understand and flexibly apply this tag to make our website content more accurate and rich.### `archiveDetail` label's basic and advanced usage When we are on a document detail page

2025-11-08

In Anqi CMS template, how does the `pluralize` filter convert a single word to plural form?

In AnQi CMS template design, we often need to handle the display of different forms of text based on quantity changes, the most common scenario being the singular and plural form conversion of words.Imagine if your website shows '1 article' and '2 articles s', that is clearly unprofessional.To solve this problem, Anqi CMS provides a very practical `pluralize` filter, which can help us easily implement the conversion of plural forms of words in templates, making the expression more natural and intelligent.

2025-11-08