As an experienced person who deeply understands 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 with its powerful content model function provides unprecedented freedom to website operators, 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 fast-changing internet environment, standardized content formats are no longer able to meet users' demand for differentiated information.Whether it is to display corporate products, release industry reports, organize online events, or operate blogs on specific themes, each type of content has its unique properties and display logic.The 'Flexible Content Model' feature of AnQiCMS is exactly for this purpose.It breaks through the rigid restrictions of traditional CMS on content structure, allowing operation personnel to customize exclusive data fields for different types of content like building blocks, thereby realizing highly personalized content creation, management, and front-end display.This greatly enhances the system's adaptability to diverse 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 in practice.It defines the data fields contained in each content, the types of these fields (such as text, numbers, options, etc.), and their display methods.The system is pre-installed with the 'Article Model' and 'Product Model', but the real power lies in its ability to allow users to 'customize content models based on business needs, achieving personalized content display'.This means that you can create a set of dedicated fields for any specific type of information, such as books, real estate, courses, events, etc., to ensure the completeness and structurization of the content.
Detailed steps for customizing the content model
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 Management' option under the navigation menu.Here, you will see the 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, such as 'Book Model', 'Real Estate Information', 'Online Course'.
- Model table name:This is the table name corresponding to the content model in the database, it must be in lowercase English letters, and it must be unique. This is an important identifier for internal system identification and data storage.
- URL alias:Using English lowercase letters, it will serve as a static rule in
{module}the call 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', to enhance the editor's intuitiveness.
The core customization process lies in the configuration of 'Content Model Custom Fields'.Click "Add field", you can add various custom attributes to the model to accurately match your business needs.Each custom field must be set:
- 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".
- Call field:This is the English identifier stored in the database, which is also the key to referencing this field in the template, for example
author/isbn/bedrooms/start_timeBe sure to use letters, concise and clear. - Field type:AnQiCMS offers a rich selection of field types, including:
- Single-line text:Suitable for short text input, such as author names, ISBNs.
- Number:Only numbers are allowed, suitable for prices, inventory, and bedroom numbers.
- Multi-line text:Suitable for longer descriptive content, such as book summaries, property features.
- Single choice, multiple choice, dropdown choice:These types are used to provide preset options for users to choose from, such as "Book type" (novel, science and technology), "House orientation" (east, south, west, north).In the "default value", enter each option on a separate line, and the system will automatically parse it.
- Mandatory?:Set according to business logic to ensure that key information is not missing.
- Default:Provide a default value for the field to improve the efficiency of content publishing. This is where you define the option list for select-type fields.
For example, if you want to create a 'Book Model', you can add the following custom fields:
- Book Title(Title, already exists)
- Author(Parameter name: Author
bookAuthor, Type: Single-line text) - ISBN number(Parameter name: ISBN number, call field:)
isbn, Type: Single-line text) - Publisher(Parameter name: Publisher, call field:}
publisher, Type: Single-line text) - Publish Date(Parameter name: Publish Date, call field:
publishDate, Type: Single-line text) - Price(Parameter name: Price, call field:
price, Type: Number) - Book Type(Parameter name: Book type, field called:
bookType, Type: Dropdown selection, default value: Novel Science Humanities)
After completing the field configuration, 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 frontend display.
When adding new content in the background (for example, "publish document"), you will first select a category.Please note that each category is bound to a content model. Therefore, when you select a category that is bound to a custom "Book model", in the "Other parameters" collapse box in the editing interface, you will see all the custom fields defined for the "Book model" just now, waiting for you to fill in the corresponding content.This ensures that each 'book' content can store all key information according to the preset structure.
Next, it is about how to display these personalized contents in the front-end template.The AnQiCMS template system uses syntax similar to Django, calling data through specific tags.
Call specific custom fields:For a single custom field like 'author' or 'ISBN number' where you know the field name, you can use it directly
archiveDetailGet the tag. For example, on the book detail page, if you want to display the 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 you want to display all custom properties in a general way (for example, listing all parameters on the product details 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 'parameter name' of the field.item.ValueThis corresponds to the value.Custom field for handling image types:If your custom field is of image type (for example, the 'cover image group' added to the book model),
archiveDetailAn image URL array will be returned. 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 a content list page (such as a category list page), althougharchiveListTags are mainly used to obtain basic information about documents, but you can still use them within the loop to target each document itemarchiveParamsorarchiveDetailCall its custom field to achieve personalized display of list items, for example, displaying the author or price in a book list.
Advanced customization and practice
To maximize the effectiveness 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 set of exclusive templates for a custom content model. For example, for a "book model", you can create
book/detail.htmlas the template for its detail page, as well asbook/list.htmlAs its list page template. This ensures that the content of this type has a unique and visually appealing presentation that conforms to its characteristics.By specifying 'category template' and 'document template' in the category settings, you can closely associate these custom templates with your content model. - optimization of static rules:When defining a custom content model, the model-level
URL别名and classification level自定义URLIt is crucial for SEO. By combining the pseudo-static rule management feature of AnQiCMS, you can set clear and semantically meaningful URL structures for your custom model content, such as/books/programming-go-languageTo enhance the friendliness of the search engine. - Detailed SEO settings:When publishing content based on a custom model, do not ignore the SEO title, keywords, and description settings in the 'Other Parameters'.These are specific SEO optimization points for the content model, ensuring that each piece of content performs better in search engines.
- Operate model deletion with caution:AnQiCMS is
help-content-module.mdIt clearly states: "When you want to delete a model, you must think carefully, and after deleting the model, all documents and categories under the model will also be deleted."}This is a very important warning, be cautious when operating in the production environment and make sure to back up your data.
By following these steps and **practice, AnQiCMS users can fully control the content structure of the website and create highly customized and attractive websites.This flexibility not only improves the efficiency of content management, but also makes your website stand out among homogenized content, accurately meeting the personalized needs of readers.
Frequently Asked Questions (FAQ)
1. Should I choose to modify the existing model or create a brand 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", just needs a little extension, and you want the content to still belong to the existing 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 wish to have completely independent management and display logic, it is strongly recommended to create a new content model.The new model can provide clearer classification, a more independent management process, and more flexible front-end display design.
2. Can the content of a custom content model be associated or referenced with the content of other models?The AnQiCMS content model mainly focuses on the storage and display of structured content.Although the system does not directly provide the "关联字段" type across content models, you can achieve it through some indirect methods.For example, in a custom model's text or multi-line text field, manually enter or reference the link or ID of other model content.In the front-end template, you can usearchiveDetailorarchiveListLabel, combine these IDs or links to dynamically retrieve and display related content. This requires some template-level logical processing.
3. What impact will there be if I modify the 'invocation field' of the custom field after I have already added content?Modifying the "call field" of a custom field is a careful operation.Due to the 'called field' being the actual column name stored in the database, 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. It is recommended