When building website content, we often find that various types of information have unique display requirements.A news article may require a title, author, release date, and main content; a product introduction may cover name, model, price, stock, and detailed parameters; while a case study may focus more on project name, client, solution, and result images.Traditional CMS systems often provide fixed and unchangeable content publishing templates, which can be quite limited when facing diverse business scenarios and difficult to respond flexibly.
English CMS is designed to address this pain point, one of its core advantages being that it provideshighly flexible content model customization features.This feature allows you to break free from the constraints of preset frameworks, tailor the most suitable management and display methods according to actual business logic and content structure, and thus achieve truly diverse content presentation.
Why do you need a custom content model?
Imagine that you are running a comprehensive website that includes various business sections, such as a corporate website that publishes industry news and sells various products.News and products have an essential difference in data structure.News may require fields such as "sourceIf all content is squeezed into a "article" model, it will be disorganized in the background management, and it will also be difficult to implement personalized layouts and functions on the front end.
The custom content model of AnQi CMS provides an ideal solution for such scenarios.It allows you to create independent data structures for different content types, ensuring that each type of content can be managed accurately and efficiently.This can not only greatly improve the operational efficiency of the background, but also ensure that every part of the content on the front-end of the website is presented to visitors in the most appropriate and attractive way, significantly enhancing the adaptability and user experience of the system.
How to create and configure content models in AnQi CMS?
Create and configure content models in AnQi CMS, the process is intuitive and powerful.Firstly, you need to enter the background management interface, find the "Content Management
The system defaults to built-in "Article Model" and "Product Model" as commonly used models, which can serve as a reference for you to quickly get started and can also be modified as needed.Of course, if you have more unique business needs, you can always click "Add Custom Model" to create a brand new content model.
When creating or modifying content models, you will find some key configuration options:
- Model nameThis is the Chinese name you recognize this model in the background, for example, "Recruitment Information
- Model table name:This is the name of the table in which the content data is stored in the database. The table name should be written in lowercase English letters, and the system will read and write data based on this table name.
- URL alias:这个英文小写字母的别名将用于前端URL路径中,有助于构建友好的伪静态链接,例如“news”、“product”、“team”。
- Title nameThis field will replace the default 'Title' prompt text, for example, in the product model, you can set it to 'Product Name' to make the published content more guiding.
The core of truly realizing diversified content display iscustom fields of the content model. Here, you can add an unlimited number of exclusive fields for your model to collect and store any necessary data.
For example, when creating a "Property Information" model, you can add:
- Area": single-line text
- Type of house": dropdown selection (for example: one bedroom, two bedrooms, three bedrooms)
- “Area”:Numeric type
- “Price”:Numeric type
- “Features”:Multiple choices (e.g., school district housing, subway housing, high-quality decoration)
- “房源图片”:Picture group type (uploaded through the system's image upload function)
How to use a custom content model for diverse content display?
Once the content model and its custom field configuration are completed, the next key point is how to beautifully display it on the website front-end.The AnQi CMS adopts the Django template engine syntax, which is concise and powerful, allowing you to easily display the backend data to visitors.
For a single content detail page, such as a news article or a product page, you can usearchiveDetailLabel to get detailed information about the current content, including all custom fields. For example, if you define a product model namedpriceThe custom field, in the product detail page template, can be displayed directly through{{archive.price}}to display the price, or through{% archiveDetail with name="price" %}tags to call.
Further, if you wish to display all custom fields, especially for lists that may change frequently, such as product parameters,archiveParams
而对于内容列表页,例如新闻列表或产品列表,archiveListThe label is responsible for retrieving the content collection.When looping through each content item, you can also access all its standard fields and custom fields.This means that you can design completely different layouts for different list pages based on the type of content model.An employment information list can highlight the position name, location, and posting time; a team member list can show names, positions, avatars, and profiles.
The Anqi CMS also provides powerful template customization capabilities.You can specify an independent template file for specific categories or even individual content pages.article/list.html模板,而“产品展示”分类则可以启用product/list.htmlTemplate. Even, for a special "About Us" page, you can customize a unique onepage/about.htmlTemplate.This highly granular template control ensures that each content type on the website has a dedicated visual presentation that matches its properties and functions, truly realizing a perfect integration of content and design, bringing visitors a rich and targeted browsing experience.
The custom content model feature of AnQi CMS is not just about data storage, but also the art of content presentation.It gives the website great flexibility and expressiveness, allowing your website to evolve continuously with business development, showcasing diverse and attractive content in the most user-friendly manner.
Common Questions (FAQ)
What are the differences between the fields in the custom content model and the fields自带的文章/product title, content, etc.?In each content of AnQi CMS (whether it is articles, products, or custom models you create), there will be some fixed and common fields, such as "TitleAnd 'Custom Field' is a specifically tailored additional attribute for a particular content model, which only exists for the content under that model.For example, the 'Price' or 'Stock' under the 'Product Model' are its unique custom fields, which are usually not needed under the 'Article Model'.This makes the content structure clearer and more efficient to manage.
Will published content be affected if I modify the field of the content model (such as adding or deleting a custom field)?In most cases, adding a custom field will not affect the display of published content, but these contents will be displayed as empty on the new field. When deleting a custom field, the system will prompt you that this operation will delete all