The secret of AnQiCMS content model: Create a unique content display structure for you
In the world of content management, website content is not monotonous.The structure and fields of a blog article, an e-commerce product page description, or the presentation of corporate event information are often quite different.The traditional CMS system may only provide fixed article or page templates, and once the business requirements change, the website becomes inadequate and difficult to respond flexibly.However, AnQiCMS solves this pain point with its 'flexible content model' feature, allowing you to deeply customize the display structure and fields of website content according to your actual business needs, thereby achieving more accurate and personalized content management.
Why is the content model so important?
Imagine that if you run a real estate website, in addition to the basic 'article title' and 'article content', you also need to add special fields such as 'apartment type', 'area', 'orientation', 'price', 'location', etc. for each property.If you only rely on traditional rich text editors to fill in this information, not only is the data entry efficiency low, but worse still, when users browse, these key pieces of information will be lost in a sea of text and will be difficult to grasp at a glance.Furthermore, search engines also cannot understand these unstructured data very well, which affects the SEO performance of the website.
The flexible content model of AnQiCMS was born to solve these problems.It allows you to create dedicated data structures for different types of content, just like building blocks.This means you can:
- Achieve precise classification and management of content:Separate content of different nature (such as articles, products, services, cases, activities, etc.) clearly, each type of content has its unique set of properties.
- Improve content entry efficiency:Content editors only need to fill in the information according to the preset fields, avoiding format confusion and missing key data, greatly improving work efficiency.
- Optimizing user experience: Visitors to the website can quickly locate and filter the information they are interested in, making the content display more organized and professional.
- Enhance SEO performance:Structured data is easier for search engines to understand and crawl, which helps improve the search ranking of a website.
AnQiCMS's 'Flexible Content Model': From Concept to Practice
How exactly do we use this powerful feature to customize content in AnQiCMS?
First, you need to enter the AnQiCMS administrative interface.Under the 'Content Management' module in the sidebar, you will find the 'Content Model' option.AnQiCMS provides the "article model" and "product model" as two basic content models by default, which can be used as a starting point for creating new content types or can be directly modified.
Field customization: Inject vitality into your content
Click on any content model (or create a new model), and you will see the field list included in the model.This is the core area for customizing the content structure. You can add unique custom fields to the model, each carrying specific information.
When adding or editing fields, there are several key settings that we need to pay attention to:
- Parameter name (display name):This is the field name displayed in the background content editing interface, it should be clear and understandable for the content editor. For example, 'author', 'product price', 'house area', etc.
- Call field:This is the unique identifier used to call the field content in the template.it must be english lowercase letters, and unique throughout the site, because the template is used to retrieve and display data through this identifier.For example, you set the parameter name to "author", then the "field called" can be
author. - Field type:AnQiCMS offers various field types to adapt to different data formats:
- Single-line text:Suitable for short text information, such as "author name", "brand name".
- Number:Suitable for numerical data, such as "price", "inventory quantity", "room number".
- Multi-line text:Suitable for scenarios requiring longer text descriptions, such as "product features", "detailed introduction".
- Single choice:Provide multiple preset options, but only one may be selected, for example, 'Color' (red, green, blue).
- Multiple selection:Provide multiple preset options and allow multiple selections, such as "Product Features" (waterproof, dustproof, fast charging).
- Dropdown selection:Similar to single selection, presented in a dropdown menu format to save space, such as "Origin", "Size".
- Mandatory?:You can set whether this field is required to be filled in when content is published, which helps to ensure the completeness and standardization of the content.
- Default:Set a default value for the field, which can be automatically filled in when creating content, further improving efficiency, especially for single-choice, multiple-choice, and dropdown selection types of fields, where it will be used to define the optional option values.
By combining and configuring these fields, you can build almost limitless display structures for different types of content.For example, add fields such as 'activity time', 'location', and 'registration link' to the 'activity' model;Add fields such as 'duration', 'instructor', 'target audience', and others to the 'course' model.
Content Entry: The Stage of Custom Fields
When you add or edit articles, products, or any other content created based on a custom content model in the background, in addition to the regular title, content editor, categories, and other options, you will see all the customized custom fields for that model in the "Other Parameters" area.The content editor simply needs to fill in the information here step by step, and the system will perform the corresponding verification and storage based on the field type, the whole process is intuitive and efficient.
Template Invocation: Let the Content Model Present Gracefully on the Front End
The backend content model and field settings are all for the purpose of displaying on the website front end.AnQiCMS template tag system perfectly connects background data with front-end display.
In the template file, you can call the data of the custom fields in the following way:
Directly call specific fields:If you know the name of the custom field's "reference field" directly, you can use it.
{{archive.你的调用字段名}}This method to get. For example, if your article model has customizedauthorField, then in the article detail page template, you can display the author like this:<p>作者:{{archive.author}}</p>For the product model, if you have customized
priceField, then you can display it like this:<p>价格:{{archive.price}} 元</p>Loop through all custom fields:Sometimes, you may want to dynamically display all custom fields, or be unsure of the specific field names of each content. AnQiCMS provides
archiveParamsThe tag allows you to loop through all the custom fields of the current content model and display their "parameter name" and "parameter value" one by one.{% archiveParams params %} <div> {% for item in params %} <div> <span>{{item.Name}}:</span> <span>{{item.Value}}</span> </div> {% endfor %} </div> {% endarchiveParams %}This method is especially useful in scenarios such as displaying product parameter lists, service details, etc., as it can automatically adapt to the increase or decrease of backend fields without frequent modification of frontend code.
Through these flexible