In the process of building and operating a website, we often encounter such challenges: the standard article or product templates provided by the content management system (CMS) often fail to fully meet the unique needs of our business.AnQiCMS (AnQiCMS) is well aware of this pain point, and therefore, from the very beginning of its design, it has made "flexible content model" one of its core highlights, aiming to help users break free from the constraints of traditional CMS and achieve true personalized content management.
Break traditional boundaries, define your exclusive content structure
Imagine that you are running a real estate information website, where you need to post rental or sale information.It is obviously not enough to describe a property only with the 'article title' and 'article content'.You will need a series of specific fields such as 'type of apartment', 'area', 'rental/sale price', 'location', 'facilities', and so on.Or maybe you are managing a platform for event publications, then information such as 'event name', 'time', 'location', 'guests', 'deadline for registration' is indispensable.
The self-customized content model feature of Anqi CMS is exactly for solving these scenarios.It allows you to build a dedicated content structure according to your actual business needs, just like building with blocks.This means that your website is no longer limited to preset "article" or "product" frameworks, but can define a set of data models that best fit any type of business content.
How to build a custom content model in Anqi CMS
The AnQi CMS integrates the management of content models in the "Content ManagementThe system provides the "article model" and the "product model" as a starting point, but this is just the beginning.
Create or modify the basic information of the model:When you decide to create a new content model, you will first set some basic properties.For example, 'Model name' is the Chinese label displayed in the background and foreground of the content model, such as 'Real estate information' or 'Event details'.The 'model table name' is an English lowercase identifier used for database storage, the system will create a corresponding database table for your new content type based on it, it is recommended to choose a concise and meaningful English word.In addition, the "URL alias" will affect the display format of this type of content in the front-end URL, and the "title name" can customize the prompt language of the main title during content editing, making the back-end operation more intuitive.
The core is located: Flexible definition of custom fields:The most powerful place of the custom content model is that you can add any number and type of custom fields. Click "Custom fields of content model", and you can add various practical properties to your model:
- Parameter name and calling field:“Parameter name” is the Chinese display name of this field on the back-end interface, for example, “House type”, “Event date”.And the 'call field' is the English identifier you use in the front-end template to retrieve the data of this field. It is recommended to keep it concise and standardized.
- Diverse field types:AnQi CMS provides a variety of field types to meet the storage needs of different data:
- Single-line text:Suitable for short text input, such as "floor","phone number".
- Number:Ensure that the input data is purely numeric, such as "house area","maximum number of participants".
- Multi-line text:Suitable for entering long descriptive content, such as 'property highlights', 'event introductions'.
- Single choice, multiple choice, dropdown choice:
- Required items and default values:You can set certain key fields as 'required' according to your business needs to ensure data integrity.At the same time, setting a 'default value' for the field can provide convenience when creating content, reducing repeated input.
Content binding with the model:In Anqi CMS, the binding of content and models is realized through "document categories".When you create a new category, the system will require you to select the "document model" to which the category belongs.Once a model is selected, all content in this category will strictly follow the field structure of the model.For example, you have created a 'Apartment Rental' category and bound it to the 'Real Estate Information' model, so all content published under the 'Apartment Rental' category will display the housing fields such as 'Layout', 'Area', etc. that you define for filling in.
Content publishing experience:Once the content model and category settings are completed, when you add a document in the background, after selecting the corresponding category, Anqi CMS will automatically identify and dynamically load all the custom fields of the model, display them in the content editing interface, making content entry clear and organized.
Display custom content on the website front end
After defining the content model, how to elegantly display these personalized data on the website is another highlight of Anqi CMS.The AnQi CMS template engine (similar to Django template syntax) makes everything very intuitive.
Get a single custom field:You can directly go through the article or product detail page template in your
{{archive.您的自定义调用字段}}The form of to obtain and display the data of a specific field. For example, if you define a field called 'house type', its calling field ishouseType, then in the template, you can display it like this:<div>户型:{{archive.houseType}}</div>.Traverse all custom fields:If a content model has multiple custom fields and you want to display them in a unified area, you can use
archiveParamsThe label can obtain all custom fields in the model in a list form and traverse them in a loop, which is very suitable for displaying in areas such as product parameters and real estate details.forLoop through and display them, very suitable for displaying in areas such as product parameters and real estate details.Implement advanced filtering and search:AnQi CMS not only supports displaying custom fields, but more importantly, it allows you to build powerful front-end filtering functions based on these fields. By
archiveFiltersLabel, you can convert custom fields into interactive filtering conditions, for example, users can filter real estate listings based on conditions such as "price range", "house type", etc. CombinearchiveListTags can easily realize complex data queries and displays.
Through these flexible mechanisms, Anqi CMS returns the initiative of content management to the user, whether it is the design of content structure, the back-end input experience, or the front-end display and interaction, all of which can be highly customized to better serve your business goals.
Frequently Asked Questions (FAQ)
Q1: How to display these new fields in my website front-end template after customizing the content model?A1: The AnQi CMS template engine provides two main methods. First, you can directly use{{archive.您的自定义调用字段}}to retrieve and display specific field data, where您的自定义调用字段Is the English call field set when you define the model in the background. In addition, if you want to display or iterate over all custom fields uniformly, you can use{% archiveParams params %}Label, it will return an array containing all custom field names and values, you can iterate throughforto display one by one.
Q2: If my business requirements change, can I modify or delete existing content models and custom fields?A2: Yes, Anqi CMS supports modifying and deleting content models and custom fields.On the "Content Management" -> "Content Model" page, you can edit the model name, URL alias and other basic information, and add, delete or modify custom fields.But it should be noted that deleting the content model is a very cautious operation, as it will also delete all the bound categories and content data under the model. Please be sure to back up the data and confirm carefully before performing the operation.The modification of field type may also affect the compatibility of existing data.
Q3: Does the custom content model support multilingual?A3: AnQi CMS itself supports