AnQiCMS Content Model: The Smart Choice for Flexible and Varied Website Content
In the digital age, websites are not only platforms for displaying information, but also aggregation points for diversified content such as corporate brands, product services, and professional knowledge.When dealing with different types of content, if a fixed display structure is always used, the website content is likely to appear monotonous and difficult to manage efficiently.AnQiCMS deeply understands this, and the 'Content Model' feature it provides is the core tool to solve this pain point, helping us easily define and manage various unique content display structures.
Imagine if your website needs to publish news articles, display product details, introduce team members, or preview upcoming events. These contents often vary greatly in structure.The traditional management system may only provide a generic "article" publishing interface, forcing you to stuff product prices, event dates, and other information into the article text, or勉强拼凑 through custom fields.This is not only inefficient, but also difficult to unify and beautiful in frontend display.
The content model of AnQiCMS is like a tailor-made "blueprint" for each of your content types.It allows you to set exclusive data fields and display styles for different types of content based on actual business needs.
Content Model, Make Your Website Structure as You Like
The core concept of the content model is to decouple the content data from the display logic. It allows us to:
- Say goodbye to the same old universal templatesNo longer limited to the default types of "article" and "productYou can create various models such as 'Case Display', 'Service Projects', 'Event Schedule', 'Talent Recruitment' according to your needs, ensuring that each type of content has its exclusive structure.
- Achieve precise content entryWhen releasing a product, the system can display fields such as 'Product Name', 'Price', 'Stock', 'Details Gallery', etc.; when releasing an event, it will display fields such as 'Event Theme', 'Start Time', 'End Time', 'Registration Link', etc.Here, content editors only need to focus on fields related to the current content type, avoiding confusion and omission of information.
- Optimize content display and managementThe structured data is easier for search engines to understand, and it is also convenient for websites to filter, sort, and recommend.For background management, the content of different models is well-organized, making searching and editing more efficient.
How to create and manage content models in AnQiCMS?
In AnQiCMS backend, the content model is located under the "Content Management" module.System defaults provide the "Article Model" and "Product Model", which can be used directly or adjusted according to our specific needs.Of course, we can also completely create our brand new model.
When we create a new content model, we need to make some basic configurations:
- Model nameThis is a Chinese name that is easier for us to understand, such as 'team members', 'successful cases'. It will be displayed in the background management interface.
- Model table name:This is a unique combination of English lowercase letters used for database storage.Although we do not need to directly operate the database, understanding its use for underlying storage helps us standardize naming.
- URL AliasThis is also a combination of English lowercase letters, which will determine the URL structure of our website's front-end content.An clear and meaningful URL alias is very helpful for SEO optimization.
- Title nameThis configuration affects the hint text in the "Document Title
Custom field: The strength of content model
The feature of 'Custom Fields' makes the content model flexible and versatile.In model configuration, we can add a series of exclusive fields for each model, which will determine the specific information contained in the model content.
- Parameter nameThis is the Chinese display name of the field on the backend interface, such as “author”, “source”, “product features”, etc.
- Call fieldThis is the English name used when calling this field in the template.In order to facilitate memory and maintain code standards, we usually use meaningful English words or pinyin, such as "author
- field type:AnQiCMS provides various field types to meet different data entry needs:
- Single Line Text:Suitable for titles, short descriptions, etc., with a maximum of 250 characters.
- NumberEnsure that the input data is pure numbers.
- Multi-line text:适用于较长的文本内容,如产品描述、详细说明。
- 单项选择、多项选择、下拉选择These three types of fields are particularly powerful, allowing us to preset some options from which users can choose (single selection/dropdown) or select multiple options.These options' 'default values' are exactly what we input one by one in the background.
- Is required:English can be set as a required field for important fields to ensure content completeness.
Content combination with the model
In AnQiCMS, the content model is associated with actual content through "categoriesWhen creating a category, we must specify a content model.This means that the same content model can have multiple different categories, but each category can only belong to a specific content model.
When we publish new content in the background, we will first select the category it belongs to.Once the category is determined, AnQiCMS will automatically load all custom fields associated with the content model of the category, presenting us with a highly customized publishing interface.
How to display these model contents in the frontend template?
AnQiCMS's template system follows the syntax of Django template engine, using{{变量}}Output data,{% 标签 %}To implement logic control. For custom fields of the content model, we can flexibly call them in the template in the following way:
- Directly obtain a specific field:If you know the 'Called Field' name of the custom field (for example
author),you can use it directly on the document details page{% archiveDetail with name="author" %}to output its value. - Loop to display all custom fields:For situations where all additional parameters need to be dynamically displayed, you can use
{% archiveParams params %}Translate the content of the value field from [auto] to [English], and strictly maintain the original JSON array format.{{item.Name}}Get the parameter name.{{item.Value}}Get the parameter value. This is very practical in scenarios such as product parameter lists. - Use the specific template of the model.:AnQiCMS allows us to define independent template files for different content models. For example, the article model can use
article/detail.html, while the product model can useproduct/detail.html。This way, each model's content can have a unique layout and style.
Through the content model, AnQiCMS brings unprecedented flexibility and efficiency to website content management.Whether it is a small and medium-sized enterprise, a self-media, or a user who needs to manage multiple sites, they can easily build a personalized website with clear structure, powerful functions, and strong adaptability.
Common Questions (FAQ)
Q1: Can I change the content model of an item after it has been published?
A1:In most cases, an item of content (such as an article or a product) is associated with its category, and the category is linked to a specific content model.This means that once the content is published, the category and content model it belongs to are fixed.If you indeed need to change the model of the content item, the most direct method is to create a new content item and publish it to the category associated with the new model, then delete the old content.
Q2:Deleting a content model will have what effect?
A2:Deleting the content model is a very important operation, please be sure to be cautious.Once you delete a content model, all categories associated with the model and all documents (articles, products, etc.) under these categories will be permanently deleted and cannot be recovered.