In AnQiCMS, the content model feature is one of its core highlights, giving the website great flexibility, allowing you to break free from the constraints of traditional CMS fixed content types and customize exclusive content structures according to your business needs.Imagine if your website is not just for publishing articles or products, but also needs to display real estate information, job openings, event details, and even recipes. If you use a fixed 'article' type, these pieces of information will be difficult to organize and manage.And the content model is the powerful tool to solve this pain point.
Understand the content model: the 'skeleton' of website content
In simple terms, a content model is the blueprint for the content on your website.It defines which fields each content type should contain, what types these fields are, whether they are required, and how they should be displayed.For example, an 'article' may include a title, content, author, and publication date, while a 'product' may include the product name, price, inventory, image set, and detailed description.AnQiCMS built 'article model' and 'product model', which provides the foundation for most websites.But its real power lies in the fact that you can create a completely custom content model for any type of business.
Why is it so important to have a custom content model? It can help you:
- Capture information accurately:Ensure that each piece of content collects all the necessary specific data.
- Optimize content management:Ensure that the interface is clear and intuitive for content editors when publishing different types of content, and avoid missing key information.
- Achieve personalized display:The front-end of the website can be arranged and presented more accurately and beautifully according to the structure of different content.
- Improve SEO benefits:Structured data in an orderly manner is more conducive to search engines crawling and understanding your content, improving your website ranking.
Customize your exclusive content type: Create a custom content model.
To start customizing your content model, you first need to log in to the AnQiCMS backend.In the left menu, find the 'Content Management' option under 'Content Model'.Here, you will see the two built-in models of the system, as well as the 'Add New Model' button.
Click "Add new model", and you will enter the model creation interface. There are several key settings items that you need to fill in carefully:
- Model name:This is the Chinese name displayed in the background management interface of the model, convenient for you and your team members to identify, such as "Real Estate Information", "Job Posting", "Event Arrangement".
- Model table name:This is a very important field, it determines the table name in which your custom content field is stored in the database. Be sure to useEnglish lowercase lettersFor example, "house", "job", "event". Once set, it is not recommended to make changes easily, as this may affect existing data.
- URL alias:Used to generate the identifier for pseudo-static URLs, it is also recommended to useEnglish lowercase lettersThis will make your URL more semantic, for example
/house/list. - Title Name:This setting is very thoughtful, it will act as a prompt text for the title field when content is published.For example, if your model is 'Real Estate Information', you can set the title name to 'Real Estate Title', so that the editor can know what to fill in at a glance.
After completing the basic settings, the most core part is the "custom fields of the content model".You can add unique data fields for the current model.AnQiCMS provides various field types to meet different data storage needs:
- Single-line text:Suitable for short text input, such as 'property address', 'contact phone number'.
- Number:Specifically used for numerical input, such as 'property area', 'price'.
- Multi-line text:Suitable for long text description, such as “Real estate detailed introduction”, “Event rules”.
- Single choice (Radio):When you need the user to select one from several preset options, such as 'Apartment type: one-bedroom, two-bedroom, three-bedroom.'
- Multiple Selection (Checkbox):Allow users to select zero or more from multiple preset options, such as 'Facilities: Air conditioning, washing machine, refrigerator'.
- Dropdown Selection (Select):Similar to single selection, but presented in a dropdown menu format, suitable for situations with many options, such as 'Region: Haidian District, Chaoyang District, Xicheng District.'
When adding each custom field, you also need to configure:
- Parameter name:The Chinese display name of the field, such as "House Area".
- Call field:This is the English identifier used when calling this field in the template, for example 'area'.
- Mandatory?:Determine whether this field must be filled in when the content is published.
- Default:Provide options for single-choice, multiple-choice, and dropdown fields, one per line. For other field types, you can set preset values here.
For example, create a 'Real Estate Information' model, you can add the following custom fields:
- Parameter name:Layout,Call field:
layout,Field type:Single selection,Default:One bedroom living room Two bedrooms living room Three bedrooms living room. - Parameter name:Area (square meters),Call field:
size,Field type:Number. - Parameter name:Rent (RMB/month),Call field:
rent,Field type:Number. - Parameter name:Location area,Call field:
district,Field type:Dropdown selection,Default:Chaoyang Haidian Xicheng. - Parameter name:Property description,Call field:
house_desc,Field type:Multi-line text.
After configuration is complete, click "OK" to save your new content model.
Content filling and display: Custom model application
The custom content model not only simplifies backend management, but also allows for flexible display on the front-end website.
Content entry is more convenient:Once you have created a custom content model and associated it with a category (select the corresponding model when editing the category in the document category management), when you publish a new document in that category, the basic fields such as 'document title', 'document content', etc. below the original fields will appear the custom fields you just defined.Staff can easily fill in exclusive information such as 'unit type', 'area', 'rent', etc. with hints, which greatly reduces the threshold and error rate for content entry.
Front-end page personalized display:How can you call and display these custom data on the website front-end? AnQiCMS template tags provide strong support.
- Display custom fields of a single document:In the document detail page, you can directly go through
archive.调用字段名to get the data, or usearchiveDetailtags. For example, to display the multi-language description of the property,“Housing Description”
- Display custom fields of a single document:In the document detail page, you can directly go through