AnQiCMS Content Model: The Smart Choice for Flexible and Variable Website Content Creation
In the digital age, a website is not just a platform for displaying information, but also a gathering point for diverse content such as corporate brands, product services, and professional knowledge.If always using a fixed display structure for different types of content, the website content is likely to become monotonous and difficult to manage efficiently.AnQiCMS deeply knows this, 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 are often very different in structure.A traditional management system may only provide a general "article" publishing interface, forcing you to cram product prices, event dates, and other information into the article body, or勉强拼凑 through custom fields.This is not only inefficient, but also difficult to unify and beautiful in front-end display.
AnQiCMS's content model, as if tailor-made 'blueprints' for each of your content types.It allows you to define exclusive data fields and display methods for different types of content based on actual business needs.
Content Model, make your website structure as you wish
The core concept of the content model is to decouple content data from display logic. It allows us to:
- Say goodbye to the same old generic templates: No longer limited to the default types of "articles" and "products".You can create various models such as 'Case Display', 'Service Projects', 'Event Schedule', 'Talent Recruitment' as needed, so that each type of content has its own dedicated structure.
- Achieve precise content entryWhen publishing a product, the system can display fields such as "Product Name", "Price", "Stock", "Details Gallery", etc.When posting an event, it will display the 'event title', 'start time', 'end time', 'registration link', and so on.This way, the content editor only needs to pay attention to the fields related to the current content type, thus avoiding confusion and omissions.
- Optimize content display and management: 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 search and editing more efficient.
How to create and manage content models in AnQiCMS?
In the AnQiCMS backend, the content model is located under the "Content Management" module.The system provides the 'article model' and 'product model' by default, which can be used directly and can also be adjusted according to our specific needs.Of course, we can also completely create our own new model.
When we create a new content model, some basic configurations need to be made:
- Model nameThis is a Chinese name that is easier for us to understand, such as 'team member', 'successful case'. It will be displayed in the management interface of the background.
- Model table nameThis is a unique combination of lowercase English letters used for database storage.Although we do not need to operate the database directly, understanding its use for underlying storage helps us standardize naming.
- URL aliasThis is also a combination of lowercase English letters, which determines the URL structure of the front-end content of our website.A clear and meaningful URL alias is very helpful for SEO optimization.
- Title NameThis configuration will affect the prompt text of the "Document Title" input box when publishing content, for example, for "Product Model", we can set it to "Product Name" so that publishers can see at a glance.
Custom field: The power of the content model
The flexibility and variability of the content model is truly brought about by its "custom field" feature.In the 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 back-end interface, such as 'author', 'source', 'product features', etc.
- Field invocationThis is the English name used when calling this field in the template.To facilitate memory and maintain code standards, we usually use meaningful English words or pinyin, such as 'author', 'source', 'features'.
- Field type: AnQiCMS provides various field types to meet the needs of different data entry requirements:
- Single-line text: Suitable for titles, short descriptions, etc., not exceeding 250 characters.
- NumberEnsure that the input data is purely numeric.
- Multi-line text: Suitable for long text content, such as product descriptions and detailed explanations.
- Single choice, multiple choice, dropdown choiceThese three fields are particularly powerful, allowing us to preset some options that users can only select (single choice/dropdown) or select multiple (multiple choice).These options' default values are exactly what we input line by line in the background.
- Mandatory?: Can set required fields for important fields to ensure the integrity of the content.
Combining content with models
In AnQiCMS, the content model is associated with actual content through "Categories".When we create a category, we must specify a content model for it.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 the 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 front-end templates?
AnQiCMS's template system borrows the syntax of the Django template engine, using{{变量}}to output data,{% 标签 %}To implement logical control. For custom fields of the content model, we can flexibly call them in the template:
- Directly retrieve a specific fieldIf you know the name of the "called field" of a custom field (for example
author), you can use it directly on the document detail page{% archiveDetail with name="author" %}To output their values. - Loop to display all custom fieldsFor situations where you need to dynamically display all additional parameters, you can use
{% archiveParams params %}Loop through these fields, through{{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 model-specific template: AnQiCMS allows us to define independent template files for different content models. For example, the article model can use
article/detail.html, and the product model can useproduct/detail.htmlIn this way, each model's content can have a unique layout and style.
By 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 clear, powerful, and highly adaptable personalized website with this.
Frequently Asked 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 bound to the category it belongs to, and the category is associated with 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: What impact does deleting a content model have?
A2: Delete the content model is a very important operation, please 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 restored.Therefore, before performing this operation, please confirm that you no longer need the model and all related