In today's rapidly changing online environment, content has become the core bridge for enterprises to communicate with users.However, not all content can be generalized in the traditional forms of "articles" or "products.From complex real estate information, detailed course introductions, to personalized team member displays, each business has unique content structure requirements.As an experienced website operations expert, I fully understand the importance of a flexible and customizable content management system for improving operational efficiency and meeting user needs.AnQiCMS, this powerful CMS developed based on the Go language is shining in this aspect, and one of its core highlights is the 'flexible content model' feature.
This feature allows AnQiCMS to be more than just a simple content publishing platform, but a content management center that deeply adapts to your business logic. It allows you to customize according to your actual business needs,Custom Content ModelThus, personalized content display and management are achieved, greatly enhancing the system's adaptability and scalability.How can we make full use of this powerful feature in AnQiCMS?
Why do you need a custom content model?
Imagine if your website needs to display various real estate information, and the traditional "article" model only has a title and body, you will find that you need additional fields to describe the house type, area, price, location, supporting facilities, and other key information.Force these pieces of information into the main text, not only does it lead to chaos in management, but it is also not conducive to user filtering and search engine crawling.Similarly, an online course platform needs course duration, instructor, difficulty level, etc., and a recruitment website needs job responsibilities, requirements, salary range, etc.
Custom content model is designed to solve these pain points. It enables your content management system to truly understand and carry your business data, bringing numerous obvious values:
- Structured Data ManagementEnsure that content of each type is stored in a unified and standardized structure, which is convenient for management, search, and secondary development.
- Personalized Content DisplayEnglish according to model characteristics, accurately present the required information on the front-end page, and enhance the user experience.
- Optimize SEO effect:Structured data helps search engines better understand the content of the page, improve crawling efficiency and ranking.
- Improve operational efficiency:Content publisher only needs to fill in the preset fields, reducing errors and repetitive work in content creation.
- Highly adaptable to business changesWhen the business model is adjusted or a new content type is added, there is no need to modify the underlying code; it can be quickly responded to through backend configuration.
AnQiCMS is exactly through its flexible content model, helping small and medium-sized enterprises and content operation teams break through the limitations of traditional CMS, and achieve more efficient and targeted content management.
English content model core mechanism
AnQiCMS built-in "article model" and "product model" as the most basic content types, which are the starting point of your customization journey. But the real power lies in, you can createThe content model is brand new and fully conforms to your business logic.
Each content model consists of two main parts:Basic informationandCustom fields.
Basic informationThis includes the model name (used for background identification and front-end display), the model table name (the table in the database where custom fields of the model are stored, it must be English lowercase letters and unique), URL alias (used in the pseudo-static rules of the URL path, also English lowercase and unique), and title name (for example, if you create a "Listing
Custom fieldsThis is the core of defining the flexibility of the content model.You can add any number of custom fields for each model to accurately capture every attribute of the content.
- Single Line Text:适用于短文本输入,如作者名、联系电话。
- Number:仅允许输入数字,如价格、库存量、房间面积。
- Multi-line text:Suitable for longer text descriptions, such as property introductions, course outlines.
- Single selection:Provide preset options for user selection, such as property type (residential/commercial), course difficulty (beginner/intermediate/advanced).
- Multiple selection:Provide preset options for user selection, such as property features (school district houses/metro houses/finely decorated).
- Drop-down selection:Similar to single choice, but presented in the interface as a dropdown menu, saving space.
When adding custom fields, it is especially important to distinguish between 'parameter name' and 'call field'.“Parameter name” is the Chinese name displayed in the background editing interface, which is convenient for operators to understand; while “Field name” is the English name you use in the front-end template to obtain the data of this field, it is the key to connect the background data with the front-end display. It must be in lowercase English letters and ensure its uniqueness and descriptiveness.
Hands-on Practice: Step by step to customize the content model.
Now, let's step by step create a custom content model to meet a hypothetical 'online activity publishing' business requirement.We hope the event we release includes information such as event name, event time, event location, guests, registration fee, and event poster.
Step 1: Enter the content model management interface.
First, log in to your AnQiCMS backend management interface, find "Content ManagementYou will see the built-in "article model" and "product model".
第二步:Create new content model
Click the 'Add new model' button to start creating our 'Event' model:
- Model nameFill in 'Event model'.
- Model table name:Suggest filling in “activity” (in lowercase English, to avoid conflict with the system or other models).
- URL alias:fill in 'activity' (in lowercase English, it will affect the frontend URL path).
- Title nameEnter "Activity Name" (this will display as the main title when the event is published).
Step 3: Define custom fields
Now, add the required detailed fields for the 'Event Model':
Event Time:
- Parameter name:Event Time
- Call field:activity_time
- field type:Single-line text (can input date and time string)
- Is required: Yes
Event location:
- Parameter name:Event location
- Call field:activity_location
- field type