AnQiCMS provides a flexible and powerful content model feature, allowing website administrators to create and manage diverse content types according to their unique business needs.This is not just a simple publication of articles or products, but to build a dedicated 'blueprint' for each type of content, ensuring the structurization and standardization of information, thus better for display and management.
Why do we need to customize the content model?
In traditional website content management, we often encounter a problem: all content seems to be forced into the universal framework of 'article' or 'news.' But the actual business scenarios are far more complex:
- E-commerce websiteThe product price, inventory, SKU, brand, material and other detailed parameters need to be displayed.
- Real estate agencyManagement of house area, house type, location, rent, orientation and other information required.
- Recruitment PlatformNeed to publish the job title, job responsibilities, qualifications, salary range, and work location, etc.
- Event Planning CompanyIt is necessary to display the event theme, time, location, participation methods, and registration deadline, etc.
If only a simple text editor is used to carry this information with huge differences, not only will the content input become confused, but it will also be difficult to unify and beautiful in front-end display. What's more, search engines also cannot understand the specific meaning of this content very well, which affects the SEO performance of the website.AnQiCMS's custom content model was born to solve these pain points, allowing you to define exclusive data structures for different types of content to meet the needs of personalized content display.
The core concept of AnQiCMS content model
In AnQiCMS, the 'content model' can be understood as an abstract definition of a content type, which determines the field composition, input method, and display rules of the content of this type.The system includes common content models such as 'Article Model' and 'Product Model' as a foundation for quickly building websites.But its real strength lies in the fact that you can create an unlimited number of custom content models based on business needs.
The content model has a clear hierarchical relationship with categories and documents:
- Content modelIt is the highest-level definition, specifying which fields a certain type of content should include.For example, the 'news model' may include fields such as 'title', 'publish time', 'author', 'content', etc.; the 'course model' may include fields such as 'course name', 'lecturer', 'start time', 'course duration', etc.
- CategoryEach category must belong to a specific content model.This means that when you create a "Company NewsBy categorizing, you can further refine the content type, but the underlying data structure is still determined by the content model.
- DocumentThis refers to specific content entries such as articles, products, events, and so on.Each document must be published under a specific category, therefore it naturally follows the field structure of the content model belonging to that category.
This design ensures the rigor and manageability of the content, when you enter content in the background, you will see a dedicated input box preset for the content model, rather than a universal form.
How to customize the content model in AnQiCMS
The process of customizing content models is intuitive and powerful, mainly performed in the 'Content Management' module of the AnQiCMS backend.
- Enter content model managementLog in to the AnQiCMS backend, find "Content Management" in the left navigation bar, click to enter, and select "Content Model".You will see the built-in 'article model' and 'product model', and you can also click 'Add new model' to create your own content type.
- Create or modify model basic information:
- Model name: This is the Chinese name you identify the model in the background, such as 'Recruitment Position', 'Real Estate Information'. It will also be used as the display name in some cases of the front-end breadcrumb navigation.
- Model table nameThis is a key internal identifier, usually a lowercase English letter, which determines the storage location of the model's data in the database.Although the system is automatically generated, understanding its role helps to understand the system architecture.
- URL aliasThe same is English lowercase letters, used to construct the pseudo-static URL of the model content. For example, if the model name is "Recruitment Position", the URL alias can be set to "job", then the related page URL may contain
/job/This is very important for SEO. - Title NameThis setting is very user-friendly.For example, if you create a "product model", you can set the title name to "product name"; when creating a "course model", set it to "course title".This way, the content editor will see more appropriate title prompts when publishing documents under this model, enhancing the operational experience.
- Core: Custom content model fieldThis is where the 'magic' of personalized content display lies.On the model settings page, you can add dedicated fields for the model instead of relying solely on 'Title' and 'Body'.
- Parameter NameThis is the display name of the field, which will appear in the background content editing interface. For example, 'House area', 'Education requirements', 'Event poster'.
- Field invocationThis is the name stored in the database for this field, and it is also the identifier you need to use when calling the data in the template.Generally, English is used, for example, “area”, “education”, “poster”.This is an important bridge connecting backend data and frontend display.
- Field type: AnQiCMS provides various field types to accommodate different data entry and display needs:
- Single-line text: Suitable for short text input, such as product models and contact names.
- NumberEnsure that the input is numeric, such as price, stock, age.
- Multi-line textSuitable for longer texts, such as product details, job descriptions, which are usually accompanied by a rich text editor.
- Single choice/Multiple choice/Dropdown choice: Provide preset options for selection, such as product color (single choice), hobbies (multiple choice), and city list (drop-down).These types of options are set one per line in the "Default Value".
- Mandatory?You can set whether a field is required, forcing the content editor to provide complete information.
- Default valueTo set a default value for a field, improve the efficiency of content entry. For selection fields, this is used to define the available options.
By combining these custom fields, you can build a model that is most suitable for any type of content.
Apply the custom content model to actual display.
After defining the content model, the next step is how to elegantly display these structured data on the website front-end.AnQiCMS through its powerful template engine makes the calling of custom fields extremely convenient.
When you add a document under a category in the background, if the category belongs to a custom model you have defined, you will find that the content editing interface will also display the custom fields you have defined in the model, in addition to the usual title, text, etc.The editor only needs to fill in according to the prompts.
There are mainly two ways to call these custom fields in the front-end template:
- Directly through the document objectFor most simple custom fields, you can directly access
archive.调用字段名The form to obtain. For example, if you define a "product model" named "brand" (the called field isbrandSingle-line text field, in the product detail page template, you can display the brand information like this: `twig`Brand