As a senior personnel who is deeply familiar with the operation of AnQiCMS, I know that the core value of a content management system lies in its flexibility and scalability, especially in meeting the growing demand for personalized display.AnQiCMS relies on its powerful content model features to provide website operators with unprecedented freedom, enabling them to build content structures that fully meet their own needs according to specific business scenarios.
Embrace personalized display: The core value of AnQiCMS content model
In today's rapidly changing network environment, standardized content formats are difficult to meet users' needs for differentiated information.Whether it is displaying corporate products, releasing industry reports, organizing online events, or operating blogs on specific themes, each type of content has its unique attributes and display logic.The 'Flexible Content Model' feature of AnQiCMS is exactly for this.It breaks the rigid restrictions of traditional CMS on content structure, allowing operators to customize exclusive data fields for different types of content like building blocks, thus achieving highly personalized content creation, management, and frontend display.This greatly enhances the system's adaptability to various business scenarios and lays a solid foundation for building a unique user experience.
Deep understanding of AnQiCMS content model
In AnQiCMS, the content model is not just a concept, it is the basic framework for managing different content types.It defines the data fields contained in each type of content, the types of these fields (such as text, numbers, options, etc.), and their display methods.System defaults to built-in "Article Model" and "Product Model", but the real power lies in its ability to allow users to "customize content models according to business needs and achieve personalized content display".This means that you can create a set of exclusive fields for any specific type of information such as books, real estate, courses, activities, and more, ensuring the completeness and structuredness of the content.
Detailed steps for customizing content models
To make full use of the AnQiCMS content model function, you usually need to go through the following key steps:
First, log in to the AnQiCMS backend management interface, find the "Content Model" option under "Content Management" in the navigation menu.Here, you will see a list of existing content models.You can choose to modify an existing model, but to meet new personalized needs, it is usually recommended to click the 'Add' button to create a new content model.
When creating a new model, you need to fill in the following basic information:
- Model name:This is the Chinese display name of the model, which should clearly describe the content type of the model, for example, "Book Model
- Model Table Name:This is the table name corresponding to the content model in the database, which must be in lowercase English letters and unique. It is an important identifier for the system to recognize and store data.
- URL Alias:Using English lowercase letters, it will serve as a static rule in the
{module}called value, which directly affects the URL structure of the front-end page, is crucial for SEO. - Title Name:This is the prompt for the main title of the content when publishing the model, such as 'book name', 'real estate name', 'course name', which enhances the editor's intuition.
The core customization process lies in the configuration of 'Content Model Custom Fields'.Click "Add field" to add various custom attributes to the model to precisely match your business needs.
- Parameter name:This is the Chinese name of the field that can be read on the background interface and template, such as 'Author', 'ISBN number', 'Number of bedrooms', 'Time of opening class'.
- Field call:This is the English identifier stored in the database, and it is also the key to referring to this field in the template, for example
author/isbn/bedrooms/start_timeMake sure to use English letters, concise and clear. - Field Type:AnQiCMS provides a variety of field type choices, including:
- Single-line text:Suitable for short text input, such as author name, ISBN.
- Numbers:Only numeric input is allowed, suitable for price, inventory, number of bedrooms.
- Multi-line text:Suitable for longer descriptive content, such as book summaries, property features.
- Single choice, multiple choice, dropdown selection:These types are used to provide preset options for user selection, such as 'Book Type' (novel, science and technology), 'House Orientation' (east, south, west, north).In the "Default value", enter each option per line, and the system will automatically parse it.
- Mandatory:According to business logic setting, ensure that key information is not missed.
- Default value:Provide a preset value for the field to improve the efficiency of content publishing. Especially for selection type fields, this is where the option list is defined.
For example, if you want to create a 'Book Model', you can add the following custom fields:
- Book Name(Title, exists)
- 作者(Parameter name: Author, calling field:)}
bookAuthor, Type: Single-line Text) - ISBN Number(Parameter name: ISBN Number, Field name:)
isbn, Type: Single-line Text) - Publisher(Parameter name: Publisher, Field name:)
publisher, Type: Single-line Text) - Publication Date(Parameter name: Publication Date, Calling field:)
publishDate, Type: Single-line Text) - price(Parameter name: Price, Calling field:)
price, Type: Number) - Book Type(Parameter name: Book type, Calling field:)
bookType, Type: Dropdown selection, Default value: Novel\nScience\nHumanities)
Complete the field configuration and save your content model.
Integrate the custom model into content creation and display.
After customizing the content model, the next step is to apply it to actual content creation and front-end display.
When adding new content in the background (such as "publish documents"), you will first select a category.Please note that each category is bound to a content model.Therefore, when you select a category bound to a custom 'Book Model', you will see all the custom fields defined for the 'Book Model' in the 'Other Parameters' collapsible panel on the edit interface, waiting for you to fill in the corresponding content.This ensures that each "book" content is stored with all key information according to the preset structure.
Next, it is about how to display these personalized contents in the front-end template.AnQiCMS's template system uses syntax similar to Django, calling data through specific tags.
Call specific custom fields:For single custom fields where you know the field name, such as "author" or "ISBN number", you can use them directly.
archiveDetailLabel to get. For example, on the book detail page, if you want to display author information, you can use:<div>作者:{% archiveDetail with name="bookAuthor" %}</div>Or define a variable first and then use:
{% archiveDetail bookAuthorValue with name="bookAuthor" %}{{bookAuthorValue}}Loop to display all custom fields:If your model contains multiple custom fields, or if you wish to display all custom properties in a general way (for example, listing all parameters on the product detail page), you can use
archiveParamsLabel. This label will return an array object containing all custom field names and values. You can iterate over it to dynamically display.{% archiveParams params %} <ul class="custom-fields-list"> {% for item in params %} <li> <span>{{item.Name}}:</span> <span>{{item.Value}}</span> </li> {% endfor %} </ul> {% endarchiveParams %}Here
item.NameIt will display the Chinese name of the field “parameter name”,item.ValueThis is the corresponding value.Handle custom fields of image type:If your custom field is of image type (for example, the "cover image group" added to the book model),
archiveDetailThe array will return an image URL array. You need to loop through this array to display all images:{% archiveDetail bookCovers with name="bookCovers" %} <div class="book-gallery"> {% for img in bookCovers %} <img src="{{img}}" alt="书籍封面" /> {% endfor %} </div>
Although on the content list page (such as the category list page),archiveListThe label is mainly used to obtain the basic information of the document, but you can still use it inside the loop for each document itemarchiveParamsorarchiveDetailCall its custom fields to achieve personalized item display, for example, displaying authors or prices in a book list.
Advanced customization and **practice**
To maximize the utility of the content model and ensure the professionalism of the website, there are some advanced considerations and **practices:**
- Creating a dedicated template:It is crucial to create a dedicated template for a custom content model. For example, for a "book model", you can create
book/detail.htmlas its detail page template, as well asbook/list.htmlAs its list page template.This ensures that the content of this type has a unique and characteristic visual presentation.By specifying 'Category Template' and 'Document Template' in the category settings, you can tightly associate these custom templates with your content model. - the optimization of pseudo-static rules:When customizing content models, at the model level,
URL别名and at the classification level,自定义URLIt is crucial for SEO. By combining the pseudo-static rule management feature of AnQiCMS, you can set clear and semantic URL structures for your custom model content, such as/books/programming-go-languageEnglish translation: To enhance the search engine's friendliness. - Detailed SEO settings:When publishing content based on a custom model, do not ignore the SEO title, keywords, and description settings in 'Other Parameters'.These are specific SEO optimization points for the content model, ensuring that each piece of content performs better in search engines.
- Be cautious when deleting model:AnQiCMS in
help-content-module.mdIt is explicitly stated: "When you want to delete a model, you must think carefully. After deleting the model, all documents and categories under the model will also be deleted.This is a very important warning, please operate with caution in the production environment and ensure data backup.
Through the above steps and **practice, AnQiCMS users can fully master the website content structure and create highly customized and attractive websites.This flexibility not only improves the efficiency of content management, but also enables your website to stand out among homogeneous content, precisely meeting the personalized needs of readers.
Common Questions (FAQ)
1. Should I choose to modify an existing model or create a completely new content model?This depends on your specific needs.If the field you want to add is very similar to the core attributes of the existing "Article Model" or "Product Model", only requiring a small extension, and you wish these contents to still belong to the existing major category, then modifying the existing model may be more convenient.However, if the content type of your content differs greatly from the existing model, requires a large number of custom fields, and you hope to have completely independent management and display logic, it is strongly recommended to create a completely new content model.The new model can provide clearer classification, more independent management processes, and more flexible frontend display design.
2. Can the content of a custom content model be associated or referenced by other model content?The content model of AnQiCMS mainly focuses on the storage and display of structured content.Although the system does not directly provide the 'related field' type across content models, you can achieve this through some indirect methods.For example, in a custom model's text or multi-line text field, manually enter or reference links or IDs of other model content.archiveDetailorarchiveListLabel, combine these IDs or links to dynamically retrieve and display related content. This requires some template-level logical processing.
3. What is the impact if I modify the 'invoked field' of the custom field after adding content?Modifying the 'Called Field' of a custom field is an operation that requires caution.Since the 'Called field' is the actual column name stored in the database for the value of this field, once modified, the value of this field in the published content may not be read or displayed correctly, and may even lead to data loss.