When building a website, we often encounter situations where the content is not just simple 'articles' or 'products'.Traditional website content management systems are often limited to a few preset content types, which can be inadequate when facing diverse information display needs.AnQiCMS is well-versed in this, providing you with a powerful tool for easily handling various data displays through its flexible custom content model function.
Say goodbye to single content and embrace personalized data structures.
The customized content model of AnQi CMS is specifically designed to address this pain point. It allows you to create new content types that fully comply with your business needs,Create new content types that perfectly match your data structure.The system is built-in with 'Article Model' and 'Product Model' as common benchmarks. Based on this, you can expand infinitely, building models such as 'Real Estate Model', 'Course Model', 'Service Project Model', 'Activity Enrollment Model', and so on, truly realizing personalized and refined content management on your website.
Custom data field: Arrange information in place
The core of creating a custom content model lies in defining its exclusive data fields.In the Anqi CMS backend, you can add a series of fields for each custom model, which will precisely define all the information contained in the model.
- Single line text type:Suitable for brief information such as "House name", "Community name", "Contact number", etc.
- Numeric type:Applicable to numerical data such as "area (square meters)", "floor", and "price (10,000 yuan)", the system will automatically perform validity checks.
- Multi-line text type:Applicable to long text content such as 'House Description', 'Surrounding Facilities', etc.
- Single selection type: For example, "house type" (one bedroom living room, two bedrooms living room, three bedrooms living room), you can preset multiple options, and you can only choose one when publishing content.
- Multiple choice type:For example, "House Features" (north-south through, high-end decoration, school district, near subway), multiple related properties can be selected when publishing content.
- Select type below:Applicable to 'Orientation' (north, south, east, west, southeast, southwest), and preset options are provided to unify data input.
- Image/Attachment type:Used for uploading house pictures, floor plans, or related documents.
In addition to the above basic types, you can also set 'whether mandatory' for each field to ensure the completeness of key information; or set 'default value' to improve the efficiency of content publication.In this way, each content type has a unique, clear data skeleton, greatly improving the efficiency and accuracy of content management.
Template rendering: beautifully presenting structured data.
Having structured data, the next step is how to beautifully display it on the website front end.The Anqi CMS uses a template engine syntax similar to Django, allowing you to easily display data from custom content models on the page.
After you have published a set of housing information in the "Housing Model", you can call the fields you have defined one by one in the corresponding template file. For example, to display the name of the housing, you can use{{archive.Title}}; To display a custom 'area' field, you can use{{archive.面积}}(Assuming you will name the field "area". If your custom field content may contain HTML tags, don't forget to add them)|safeA filter to ensure that HTML content is parsed correctly and not displayed as escaped.
For those custom fields displayed in a list format, such as the 'features' tags of a listing, or product parameters, you can use{% archiveParams params %}Labels to iterate over all custom parameters, then render dynamically according to the field name (item.Name) and value (item.Value) to dynamically render. This method is particularly suitable for scenarios where content parameters are variable and difficult to list in advance.
In addition, the AnQi CMS template system also supports powerful list and filtering functions. You can combine{% archiveList %}tags to filter by model, category, or even custom field conditions (througharchiveFilters) to filter and display different types of list data.For example, you can implement filtering by "type" and "price range" on the listing page to provide users with more accurate property information.
Application scenarios: endless possibilities
The application scenarios of custom content models are not limited to articles and products:
- Enterprise service display:Define the 'service project model', including 'service content', 'industry applicable', 'successful cases', 'price range', and other fields.
- Activity registration system:Define the 'event model', including 'event theme', 'start time', 'end time', 'event location', 'registration deadline', 'cost', 'organizer', and so on.
- Job information posting:Define a "position model", including "position name", "number of recruitment", "work location", "duties and responsibilities", "qualification requirements", "salary range", and so on.
- Software/Solution Showcase:Define the "Solution Model", including "Solution Name", "Problem Solved", "Core Features", "Application Scenarios", "Customer Cases", and so on.
By customizing the content model, AnQi CMS makes your website not just an information publishing platform, but also a powerful content center that can flexibly adapt to various business scenarios and efficiently manage structured data.This has greatly improved the efficiency of content operations and also brought a qualitative leap in website SEO optimization and user experience.
Frequently Asked Questions (FAQ)
1. What is the difference between a custom content model and a normal category?The ordinary classification (such as "domestic news" under "news center", "international news") is mainly used for classifying content under the same content model (such as "article model"). The custom content model definesThe data structure itself of different types.For example, "article" and "housing" are two different content models, each with its own set of independent fields (articles have authors and sources, while housing has types and area), and the classifications under each model are used to further refine the content ownership.
2. After creating and adding data, can you modify or delete a custom content model?You can certainly modify the custom content model you have created, such as adding new fields, modifying field types (without affecting data compatibility).However, be sure to handle the delete operation with care.All categories and content data under this model will be permanently deleted and cannot be recoveredTherefore, please make sure you no longer need these data before deletion and make backups.
How to display the fields I added to the custom content model on the front-end page?In the front-end template, you can call custom fields through the Anqi CMS template tags. For the detail page of a single article, you can directly use{{archive.您的自定义字段名}}To display the value of a specific field. If the content contains multiple custom parameters, you can also use{% archiveParams params %}tags to iterate over all custom fields, then use{% for item in params %}{{item.Name}}: {{item.Value}}{% endfor %}The way to dynamically display them. Remember that if the field content contains HTML, it needs to be used|safea filter to ensure correct rendering.