As an experienced CMS website operation personnel for security, I am well aware of the importance of the flexibility of the content model for website operation efficiency and personalized content display.The powerful content model customization function is instrumental in making AnQi CMS the preferred tool for small and medium-sized enterprises and content operation teams.Today, let's delve into how to customize content model fields in AnqiCMS and set their types and default values.

Understand the content model of AnqiCMS

In the Auto CMS, the content model is the foundation for defining the structure of various content (such as articles, products, events, etc.).System is built-in with "Article Model" and "Product Model", which provide a set of basic content fields.However, different business scenarios often require more specific and professional fields to carry information.For example, a e-commerce website's product may require fields such as "brandBy customizing content model fields, we can add unique attributes to each content model according to actual business needs, realizing highly personalized content management.

Enter content model custom field settings

To customize the field of the content model, you need to log in to the AnqiCMS backend management interface.In the left navigation bar, find the "Content Management" module and then click "Content Model".Here, you can see the built-in models of the system as well as any custom models you may have created.Select the specific content model you want to add or modify the field (whether built-in or custom), and click the edit button to enter the detail page.

In the editing interface of the content model, you will see a dedicated area for 'content model custom fields'.This is the area where we flex our muscles, adding more details to the content.Click the "Add field" button to open a form that allows you to define the various properties of the new field.

Define the properties of custom fields

Each custom field needs to be carefully configured with its properties to ensure it can store and display content correctly.

FirstlyParameter nameThis is the Chinese name displayed on the backend management interface for the field, which is convenient for you and your team members to understand its purpose. A clear parameter name can greatly improve the convenience of backend operations.

Next isCall fieldThis is the field identifier used in the template and the actual database.The CMS recommends using pure English lowercase letters as field names to ensure the accuracy and stability of system internal recognition and front-end template calls.author.

The third one isfield typeThis is the core attribute of the custom field, which determines the type of data that can be stored in the field and its display in the background. Anqi CMS provides a variety of field types for you to choose from to meet different content needs:

  • Single Line Text:Suitable for brief text input, such as article author names, article sources, product SKUs, etc., which are usually limited to 250 characters to avoid long content.
  • Number:Ensure that the input content is in numeric format. This type is suitable for fields that require numerical calculations or only allow numeric input, such as product inventory, product price, reading volume, etc.
  • Multi-line text:Used to carry long text content, such as product details, event rules, user reviews, etc. It provides a larger text input area, allowing for richer content input.
  • Single selection:Provide preset options for users to make single selections.This type is very suitable for scenarios that require standardized options, such as the 'color', 'size' of products, or the 'difficulty level' of articles.The specific content of the option will be defined by the subsequent 'default value' field.
  • Multiple selectionSimilar to single choice, but allows users to select one or more from preset options.For example, a product may have multiple 'feature tags', and users can choose several of them.The content of the option is also set in the "default value".
  • Drop-down selection:The options are presented in the form of a dropdown menu, which can effectively save space on the backend interface when there are many options. The content of the options also needs to be defined in the 'Default Value'.

The fourth property isIs requiredYou can decide whether to fill in this field when publishing content based on your business needs.If a field is crucial for the completeness of the content, such as product price or article title, you can check this option, and the system will perform a check at the time of content publication to avoid missing key information.

Finally isDefault valueThis is a very practical feature that provides preset values for new content, reducing the amount of manual input work.For fields of the type "Single-line textIt is worth noting that for the three field types of 'Single Choice', 'Multiple Choice', and 'Dropdown Selection', each line of the 'Default Value' field will be treated as a separate option.For example, you want a dropdown menu to have 'Option A', 'Option B', and 'Option C'. Just enter each option on a new line in the default value input box, and the system will automatically parse each line as one option.If the custom field has a default value and you want it to be displayed as the default value when called from the front end, simply leave the field blank when publishing the content, and the system will automatically assign the default value to the field.

By following these steps, you can flexibly customize the fields of the security CMS content model and set appropriate types and default values.This high level of customization allows AnqiCMS to adapt to various complex business scenarios, helping you manage and display website content more efficiently, thereby attracting and retaining users better.


Common Questions (FAQ)

1. Can I delete the built-in 'Article Model' or 'Product Model' of AnqiCMS?The "article model" and "product model" built into the "Anqi CMS system" can be modified in their fields, but cannot be deleted directly.This is to ensure the stability of the system's core functions and data structures.However, you can customize the creation of new content models to replace them, and gradually migrate the content to the new models.

2. In creating custom fields, I found that the name of the "Call Field" is incorrect, can it be modified?“Call field” is a unique identifier directly associated with the database table structure and template call.Once created and put into use, it is generally not recommended to make modifications.Because this may cause field association errors in published content, even leading to issues at the database level.If an error is found during the initial creation, it is best to delete this field and create it again.If there is a large amount of data, be sure to back up the data before modification and operate under the guidance of professional technicians.

3. How do I call the custom content model field in the frontend template?In AnqiCMS, you can call custom fields by using specific template tags. If the "call field" of the custom field isauthor,then in the document detail page template, you can use{{archive.author}}to directly call its value. To loop through all custom fields, you can use{% archiveParams params %}Label to get and iterate over all fields and their values. For specific usage, please refer to the template tag document of AnqiCMS.archiveDetailandarchiveParamsDescription of the tag.