As an experienced CMS website operation personnel, I fully understand the importance of flexible content management for the successful operation of the website.The AnQi CMS, with its powerful content model features, provides a solid foundation for us to meet various content needs.Next, I will elaborate on how to create and manage content models in AnQiCMS, so that you can efficiently build and publish various types of content.

Understanding the content model in AnQiCMS

In AnQi CMS, the content model is the core to define the structure of specific types of content.It acts as a blueprint for the content, specifying which fields should be included, the types of these fields, and how they should be stored and displayed.For example, an 'article' model may include title, author, body, publication date, etc., while a 'product' model may include product name, price, inventory, image set, etc.The AnQi CMS is default built-in with 'Article Model' and 'Product Model', which meet the basic needs of most websites.However, facing the diverse content display of corporate marketing, self-media operation, and other areas, the ability to customize content models is particularly crucial. It greatly enhances the adaptability of the system, allowing us to create personalized content structures according to specific business needs.

Creating a custom content model

When creating a new content model, you need to set several basic properties of the model:

FirstlyModel name. This is the Chinese name used to identify the model in the background management interface and breadcrumb navigation, please name it clearly and easily understandable according to the type of content you provide.

Next isModel table name. This name will be used as the table name for the custom field content stored in the database. Be sure to useEnglish lowercase lettersAvoid using special characters or Chinese, as irregular table names may cause content to be displayed incorrectly.

Next isURL alias. This alias is used for pseudo-static rules.{module}The field's invocation will be directly displayed in the website's URL. Therefore, it is also necessary to useEnglish lowercase lettersto define, in order to ensure the standardization and aesthetics of the URL structure.

Finally isTitle Name.This is a user-friendly setting, which will serve as the prompt text for the document title input box when publishing content.For example, if you create a product model, you can set the title name to "Product Name" so that content editors can clearly understand the purpose of this field.

Define custom fields for the content model

The most powerful feature of AnQi CMS content model is its customizable fields.You can add exclusive fields for each custom content model to accurately match your content structure needs.For example, add options such as 'color', 'size', and others to the 'product' model.

When adding a field, you need to configure the following aspects:

Parameter NameIs the field displayed to the user on the back-end interface, for example, 'article author', 'product price'.Although Chinese is supported, it is recommended to use English camel case naming conventions to improve readability and facilitate subsequent development.

Field invocationThe actual name of the field stored in the database, as well as the identifier called in the template. This field name must be usedEnglish lettersFor exampleauthororprice, and should not contain special characters or spaces.

Field typeDecided the form of content input and the way data is stored. Anqi CMS provides a variety of field types for selection, including:

  • Single-line text: Suitable for short text input, such as titles, brief descriptions.
  • Number: Only numeric input is allowed.
  • Multi-line text: Suitable for fields requiring longer text input, such as article content, product details.
  • Single choiceProvide multiple options, but only one selection is allowed, and the option values are set through default values.
  • Multiple selectionsProvide multiple options, and multiple selections are allowed, with option values set through default values.
  • Drop-down selection: Display options in a dropdown menu, only one option is allowed to be selected, and the option value is set through the default value.

Mandatory?Used to set whether the field is required to be filled in when publishing content. If set to required, the system will perform verification when the content is submitted.

Default valueCan you set a default value for the field.For single-choice, multiple-choice, and dropdown fields, the default value will be used to define all selectable options, with each option value occupying a separate line.

Management and integration of content models

After creating and defining the content model, you can modify them at any time in the admin interface.You can adjust the model name, URL alias, or add, modify, and delete the custom fields below.

However, in decidingDeleteBe particularly careful when dealing with content models. Once the model is deleted, all documents and categories under it will also be permanently deletedAll documents and categories will also be permanently deletedThis is an irreversible operation. Therefore, please make sure to consider and back up the data before performing the deletion.

When you publish documents in the background, after selecting the category to which they belong, if the category is associated with a custom content model, then you will see all the custom fields defined by the model in the 'Other Parameters' collapse box.You can fill in the content of these fields as needed.If the custom field is set to a default value and you want to use the default value, you can leave it blank.

In the front-end template, you can call the data of the content model through specific tags. For example,archiveDetailThe tag can retrieve the details of the document, including all the custom fields of the content model it belongs to;archiveParamsTags can be used to specifically retrieve the custom parameter list of a specified document. These tags make the content model seamlessly connect with the website front-end display, achieving highly flexible content output.

By using the flexible content model function of AnQi CMS, we can easily manage various complex content structures, bringing great convenience and efficiency improvement to website operation.


Frequently Asked Questions (FAQ)

Ask: Can I modify the custom fields of the built-in 'Article Model' or 'Product Model' in AnQi CMS?

Ask: Why can't I see the custom fields I defined when publishing the content I created?Answer: This is usually because the "category" you selected when publishing the content is not associated with the new content model you created.In AnQi CMS, the type of the document is determined by its category.You need to go to the 'Document Category' management page, edit the related categories, and associate them with the new content model you created. This way, when publishing documents belonging to the category, the corresponding custom fields will be displayed.

Ask: What are the consequences of deleting a custom content model?Answer: Deleting a custom content model is a very sensitive operation. Once you delete a custom content model, all documents published under that model and all associated categories will bePermanently deleteTherefore, please make sure to confirm carefully before performing this operation, and it is recommended to make a data backup in advance.