In today's fast-paced online environment, content has become the core bridge for communication between enterprises and users.However, not all content can be generalized in the traditional form of 'article' or 'product'.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 am well aware of the importance of a flexible and customizable content management system in improving operational efficiency and meeting user needs.AnQiCMS, this powerful CMS developed based on the Go language is shining in this aspect, one of its core highlights is the 'flexible content model' feature.
This feature makes AnQiCMS not just a simple content publishing platform, but also a content management center that can deeply adapt to your business logic. It allows you to meet your actual business needs,Custom content modelThus, it achieves personalized content display and management, greatly enhancing the system's adaptability and scalability.How can we make full use of this powerful feature in AnQiCMS?
Why do you need to customize the 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 layout, area, price, location, supporting facilities, and other key information.Forcefully inserting this information into the text not only causes confusion in management, but also hinders user filtering and search engine crawling.Similarly, an online course platform needs course duration, instructor, difficulty level, etc., and a job recruitment website needs job responsibilities, requirements, salary range, etc.
Custom content models are designed to address these pain points. They allow your content management system to truly understand and carry your business data, bringing many obvious benefits:
- Structured Data ManagementEnsure that content of each type is stored in a unified and standardized structure for easy management, search, and secondary development.
- Personalized content displayAccording to the model characteristics, present the required information accurately on the front-end page to enhance the user experience.
- Optimize SEO effect: Structured data helps search engines better understand page content, improve crawling efficiency and ranking.
- Improve operational efficiency:The 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 designed to help small and medium-sized enterprises and content operation teams break through the limitations of traditional CMS, achieving more efficient and targeted content management through its flexible content model.
The core mechanism of AnQiCMS content model
AnQiCMS has 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 the fact that you can createA brand new, fully compliant content model that meets your business logic.
Each content model consists of two major parts:Basic informationandCustom field.
Basic informationThis includes the model name (used for backend identification and frontend display), the model table name (the table in the database where the custom fields of the model are stored, must be lowercase English letters and unique), the URL alias (used for the URL path in the pseudo-static rules, also needs to be lowercase English and unique), and the title name (for example, if you create a "property" model, the title name can be set to "property name" to make the content editing interface more intuitive).
Custom fieldThis is the core of defining the flexibility of the content model. You can add any number of custom fields to each model to accurately capture every attribute of the content.AnQiCMS provides various field types to meet different data input needs:
- Single-line textFor short text input, such as author name, contact number.
- NumberOnly numbers are allowed, such as price, inventory, room area.
- Multi-line text: Suitable for long text descriptions, such as house introductions, course outlines.
- Single choiceProvide preset options for user selection, such as property type (residential/commercial), course difficulty (beginner/intermediate/advanced).
- Multiple selections: Provide preset options for users to select, such as property features (school district houses/ subways houses/ luxury decoration).
- Drop-down selection: Similar to single choice, but presented in the form of a drop-down menu on the interface, saving space.
When adding custom fields, it is especially important to distinguish between 'parameter name' and 'call field'.The parameter name is the Chinese name displayed in the background editing interface, which is convenient for operators to understand;While the 'call field' is the English name you use in the front-end template to retrieve the data of this field, it is the key to connecting the background data with the front-end display. It must be written in lowercase English letters and ensure its uniqueness and descriptiveness.
Hands-on practice: Step by step customization of the content model
Now, let's go step by step to create a custom content model to meet the hypothetical 'online event publication' business needs.We hope the activities we publish include the activity name, time, location, guests, registration fee, and activity poster information.
First step: Enter the content model management interface
First, log in to your AnQiCMS backend management interface, find "Content Management" through the left navigation bar, and then click the "Content Model" option.You will see the built-in 'article model' and 'product model'.
Step two: Create a new content model
Click the "Add New Model" button to start creating our "Event" model:
- Model name: Fill in the "Event Model".
- Model table name: Suggest filling in 'activity' (in lowercase English to avoid conflicts with the system or other models).
- URL aliasFill in "activity" (in lowercase, it will affect the front-end URL path).
- Title NameFill in the 'Activity Name' (this will display as the main title when the activity is published).
Step 3: Define custom fields
Now, add the required detailed fields to the 'Activity Model':
Activity Time:
- Parameter Name: Activity Time
- Field invocation: activity_time
- Field typeSingle-line text (can enter date and time string)
- Mandatory?: Yes
Event location:
- Parameter NameEvent location
- Field invocationactivity_location
- Field type