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

Calendar 👁️ 74

In Anqi CMS, the content model is the core element for building the website content structure, which provides strong flexibility, allowing you to customize the fields and display methods of content according to different business needs (such as publishing articles, displaying products, managing events, etc.).Understand and make good use of this feature, it will greatly enhance the management efficiency and display effect of your website content.

Understanding the content model of Anqi CMS

In AnQi CMS, the content model can be regarded as the 'blueprint' or 'skeleton' of the content.It defines what information fields should be included in a certain type of content.For example, an ordinary article may only need the title, author, publication time, content, and other fields;And a product may need more detailed fields such as product name, price, stock, brand, and multiple images.The AnQi CMS provides the basic models of 'article model' and 'product model' by default, but its strength lies in the fact that you can completely customize new content models according to your actual needs.

The content model is not the content itself, but the structural definition of the content.All content (referred to as "documents" in Anqi CMS) must belong to a "category", and each "category" must be associated with a specific "content model".This way, when you post a document under a certain category, the system will automatically provide the corresponding fields for you to fill in based on the content model associated with that category.

How to customize the content model

To start customizing the content model, you need to go to the "Content Management" section of the admin interface and find the "Content Model" item.Here, you can view and modify the built-in models of the system, as well as add new custom models.

  1. Create or modify the basic information of the model:

    • Model name:This is the model name displayed in the background management interface for you to see, it should clearly reflect the content type managed by the model, such as 'Real Estate Information', 'Course List', etc.
    • Model table name:This is the table name stored in the database for model data. For system compatibility and practical considerations, it is recommended to use all lowercase English letters.Once set, it is usually not recommended to change it, as it directly affects the data storage structure.
    • URL alias:This field is used for URL static rules, such as in/product/{id}.html,productIt is the URL alias. It is recommended to use English lowercase letters, which helps to optimize the website's URL structure and improve SEO friendliness.
    • Title Name:This is the prompt text in the document title input box when publishing the document under this model.For example, if the model is "product", you can set it to "product name" to make it clear to the content editor.
  2. Define custom fields - the core of the content model:The true magic lies in custom fields. These fields determine what personalized information your content can include.Click the "Content Model Custom Field" area, where you can add various types of fields to meet the needs of different business scenarios.

    • Single-line text:Suitable for short text inputs, such as “product brand”, “author name”, “source of article”, etc.
    • Number:Used for inputting numbers, such as "product price", "inventory quantity", "reading time", etc., the system will automatically perform numerical verification.
    • Multi-line text:Text suitable for long content, such as 'Product Introduction', 'Author Introduction', etc., which can accommodate more text.
    • Single choice (radio button/dropdown selection):Allow the user to select one from multiple preset options, such as 'Product color', 'Article type (news/review/tutorial).'When setting the default value, just enter each option on a separate line.
    • Multiple selection (checkbox):Allow users to select multiple options from predefined ones, such as 'Product features (waterproof/dustproof/durable)' and 'Article tags (technology/marketing/operations).'Similarly, each option is on a separate line when setting the default value.

    When adding each custom field, you can also set 'whether it is required' to ensure the integrity of key information, and provide 'default values' for the convenience of content editors to quickly fill in when publishing.For example, add a "Price" field (type: number, required) for the "Product Model", a "Brand" field (type: single-line text, default value: Anqi Technology), and a "Product Features" field (type: multiple selection, default value: Efficient\nStable\nSafe).

Combination of content model and content publishing process

After you define a content model and add custom fields to it, these fields will not be displayed on the front-end page immediately.They need to be cleverly combined with 'Categories' and 'Documents' at the time of content publishing.

  1. Associated categories:You need to create a new category (or edit an existing category) and associate it with your custom content model.For example, if you create a "Real Estate Information" model, you can create a category named "New Listing" and associate it with the "Real Estate Information" model.
  2. Publish documents:When you post a document under the "New Listing" category, in addition to the usual fields such as title and content, you will also see those custom fields defined in the "Real Estate Information" model, such as "type", "area", "price", "location", and so on.The content editor can fill in these fields based on the actual property information.

In this way, the custom fields of the content model will only appear after you have selected the corresponding category, greatly simplifying the content editing interface and avoiding unnecessary field interference.

Display custom fields in the front-end template

After customizing the content model and filling in the data, the most critical step is to display this information on the website's frontend page.AnQi CMS uses Django template engine syntax, providing flexible tags to help you achieve this.

  1. Display on the document detail page:In the document detail page template (usually{模型table}/detail.htmlFor examplearticle/detail.htmlorproduct/detail.html), you can directly call the document objectarchiveto call the custom field.

    • If you want to display a specific custom field, such as "Product Price", and the field name defined in the model isPriceHow to call:{{archive.Price}}.
    • For fields of multiple choice, single choice, or dropdown types, if you need to display all selected items in a loop, you may need to use loop tags in conjunction.
  2. Dynamically loop to display all custom parameters:If your content model contains multiple custom fields and you want to display all these fields in a single area (such as the 'specifications parameters' column on the product details page) without manually calling them one by one, thenarchiveParamsTags are very convenient.

    {% archiveParams params %}
    <div>
        {% for item in params %}
        <div>
            <span>{{item.Name}}:</span>
            <span>{{item.Value}}</span>
        </div>
        {% endfor %}
    </div>
    {% endarchiveParams %}
    

    This code will traverse the current document(archiveAll custom parameters, and display them one by one in the form of "parameter name" and "parameter value".This is especially useful for displaying product specifications, house details, and other scenarios, even if new custom fields are added in the future, there is no need to modify the template code, the system will automatically adapt.

  3. Filter and display on the document list page:Custom fields can not only be used for detail page display, but can also be combined witharchiveFiltersTag, provides powerful filtering functionality on the list page. For example, a real estate information list page

Related articles

How does AnQiCMS implement independent display and management of content for multiple sites?

In today's increasingly rich digital content, many enterprises and content operators often need to manage multiple websites at the same time.This may be because there are multiple brands, product lines, a need to serve users in different regions or languages, or operating multiple independent content branches.Traditionally, this means that it requires deploying and maintaining multiple independent CMS systems, which not only consumes time and effort but also increases operational costs and complexity.Luckyly, AnQiCMS has fully considered this pain point from the beginning of its design, one of its core highlights is to provide a powerful multi-site management function

2025-11-09

How does AnQiCMS's 'Content Management' feature affect the parameter escaping strategy when generating URLs?

The functions provided by AnQi CMS in content management have a profound impact on the parameter escaping strategy when generating URLs for websites.This is not just about the beauty of the URL, but also a key link to the website's SEO performance and user experience.Understanding the underlying mechanism can help us better build and manage websites. **One, Static Rule: The Foundation of URL Structure** Firstly, AnQiCMS lays the foundation for URL structure through its powerful "static and 301 redirect management" function.The static rules define how the URL of a website is presented to visitors and search engines

2025-11-09

How does `CanonicalUrl` work with URL parameter escaping in AnQiCMS to optimize SEO?

In website operation, Search Engine Optimization (SEO) is a key link to enhance website visibility and attract targeted user traffic.Among them, how to effectively handle duplicate content and normalize URLs is an important detail that cannot be ignored in SEO strategy.AnQiCMS (AnQiCMS) is a system designed for content operation teams, providing powerful and flexible functional support in this aspect.This article will discuss how `CanonicalUrl` in AnQiCMS works together with the URL parameter escaping feature to optimize the website's SEO performance.

2025-11-09

How to build a URL with multiple dynamic parameters in AnQiCMS template and ensure its escaping?

In website operation, a clear and semantically meaningful URL structure not only enhances user experience but is also the foundation of search engine optimization.For AnQiCMS users, it is a very practical skill to flexibly construct URLs with multiple dynamic parameters in templates and ensure that these parameters are properly escaped.This article will delve into the methods of achieving this goal in the AnQiCMS template.### URL basics and pseudo-static in AnQiCMS AnQiCMS as a SEO-friendly content management system

2025-11-09

How does AnQi CMS support the publishing of multilingual content and front-end switching display?

In today's globalized business environment, whether a website can support multilingual content publishing and switching has become an important standard for measuring its internationalization capabilities.AnQiCMS (AnQiCMS) is an efficient content management system that fully considers this requirement and provides users with a flexible and practical multilingual content solution. To understand how AnQiCMS supports multilingual, we can look at two main aspects: one is the management and publication of core content such as articles, products, and pages;Second is for fixed text in website templates (such as navigation names

2025-11-09

How to configure the static rules to optimize URL structure and improve search engine visibility?

In website operation, a clear and meaningful URL structure is not only a manifestation of website aesthetics but also a key factor in improving search engine visibility and user experience.When it comes to how to configure pseudo-static rules to optimize URL structure and improve search engine visibility?When discussing this topic, AnQiCMS (AnQiCMS) provides very flexible and powerful tools to help us easily achieve this goal.Understanding URL Rewriting: Why is it so important for optimization?Before delving into the configuration, let's talk about what pseudo-static is and why it is so important for your website

2025-11-09

What advanced SEO tools does AnQiCMS provide to improve a website's performance in search results?

Search engine optimization (SEO) is the key to the success of a website in today's digital world.An excellent website content management system (CMS) not only helps you efficiently organize and publish content, but should also be built-in with powerful SEO features to ensure your website has good visibility in search engine results.AnQiCMS is a platform that provides a series of advanced tools, aimed at helping your website stand out in a highly competitive online environment.First, the basic architecture of the website is crucial for SEO.AnQiCMS provides strong support for URL optimization

2025-11-09

What practical uses does the batch replacement feature for all-site content have for optimizing content display?

Operate a website, especially a website with a large amount of content, the most annoying thing is that you need to make unified adjustments to a large number of published content.Whether it is the transformation of the company's strategic direction, the upgrade of the product line, or the adjustment of the SEO keyword strategy, manually modifying hundreds or even thousands or even tens of thousands of articles one by one is not only inefficient, but also prone to omissions and errors.This not only consumes valuable human resources, but may also affect the overall image of the website and search engine performance.The "Full Station Content Bulk Replacement" feature of AnQi CMS is specifically designed to solve this pain point, making content optimization and display management unprecedentedly efficient and accurate

2025-11-09