How to manage document categories in AnQiCMS and how to set custom fields for categories?
As a website operator who deeply understands the operation of AnQiCMS, I am well aware of the importance of content organization and personalized display in attracting and retaining users.In AnQiCMS, the management of document categories and the setting of custom fields are the core links to achieve this goal.A good classification structure can help users quickly find the information they need, and flexible custom fields make the content display more in-depth and diverse.
Document category management: Build a clear content structure
In AnQiCMS, document classification is the foundation of website content organization.It not only determines the attribution of the content, but is also the key carrier for content models and custom field applications.By classifying and managing, we can build a clear and logical content architecture for the website, where any type of information, whether articles, products, or any other kind, can find its accurate location.
When you create or edit document categories in the background, the first task is to select the document model it belongs to.This is crucial because once the category is created and bound to a document model, the model cannot be changed anymore.This means that all content under a category will follow the field specifications of its associated document model.For example, if you select the "Article Model" for the "News Center" category, then all news content under this category will have the fields defined by the article model, such as title, content, publishing time, etc.Similarly, if the 'Product Display' category is selected as 'Product Model', then the products under it will have unique fields such as product name, price, inventory, etc.
On the category settings page, you can configure many options that help with content organization and front-end display.The category name is the key identifier displayed on the front end, and the category introduction can be used as the description information in TDK (Title, Description, Keywords), helping with SEO optimization.In addition to this basic information, you can also adjust the display order of categories to prioritize important or popular categories.On SEO, the system provides SEO title and keyword settings, allowing you to customize more search engine friendly metadata for each category.The custom URL feature provides you with greater flexibility, allowing you to customize the URL paths of category pages according to your business needs, which can further enhance your SEO performance.
To enrich the visual presentation of the category page, AnQiCMS also supports setting Banner images and thumbnails.You can upload multiple Banner images to achieve a carousel effect, and you can also set a representative thumbnail for the category to be displayed in the list or navigation.In addition, the category content field allows you to add detailed descriptions or explanations for the category page, which is particularly useful in scenarios where a deep elaboration of the category is required.The category template setting feature allows you to apply unique page layouts to different categories, for example, you can specify a dedicated template for file downloads for the “Download Center” category to meet its specific functional requirements.Further, you can choose whether to apply the category template to its subcategories, achieving inheritance or independent configuration.
Flexible setting and application of classified custom fields
The custom field of the category is not set separately on the category editing page, but is managed uniformly through the associated "content model".This design approach ensures that all categories and documents under the content model can share a standardized data structure, improving the maintainability and scalability of the system.
To set custom fields for categories, you need to first enter the 'Content Model' management interface in the background.AnQiCMS has built-in 'Article Model' and 'Product Model' two common models, and the system also supports you to create a new custom model.On the content model editing interface, you can add exclusive custom fields for the model.Each custom field contains several core configuration items:
First is the "parameter name", which is the Chinese display name of the field on the back-end management interface, such as "article author", "product series", etc., convenient for operation personnel to understand and fill in.
Next is the 'Field Name', which is the actual name of the field stored in the database and also the identifier used to call the field in the front-end template, for exampleauthororproduct_series. Suggest using concise and clear letters.
The selection of 'field type' is followed, AnQiCMS provides a variety of flexible field types to meet different data storage needs.This includes 'single-line text' for short text input, such as author name;“Numbers” are used for numeric data, such as inventory;“Multi-line text” is used for long text input, such as detailed description;and options such as 'single choice', 'multiple choice', and 'drop-down choice' etc., which are used to define preset option data, such as product color, size, etc.For the selection field, you need to enter all the optional items line by line in the 'Default Value'.
The setting of "whether mandatory" determines whether the field must be filled in when publishing content or editing categories. A reasonable setting of mandatory items helps ensure the completeness and standardization of content.
In this way, you can define fields such as "source", "editor in charge", etc. for the article model, and define fields such as "brand", "model", "material", etc. for the product model.When these models are bound to categories, these custom fields will automatically appear on the category or document editing page for you to fill in and manage.
When calling these custom fields in the front-end template, it is usually usedcategoryDetailtags. If you want to display a specific custom field value, you can use it directly{% categoryDetail with name="自定义字段名" %}The way. For example, if you define a named category modelbanner_descriptioncustom field to store the description text of a Banner, then you can pass it through the template.{% categoryDetail with name="banner_description" %}Get and display its content. For some custom fields that need to be displayed in a loop, such as custom image group fieldscatimagesYou can combine withcategoryDetailandforLoop to output one by one. This flexible calling method allows you to present the content of custom fields accurately at various corners of the page according to the design requirements of the website.
By fine management of document classification and flexible configuration of custom fields, AnQiCMS empowers operators to build a website with strict structure, rich content, and personalized features, thereby better serving target users and achieving the operational goals of the website.
Frequently Asked Questions (FAQ)
1. Can a category be changed to a different content model after it has been created and associated with a content model?Cannot. Once bound in AnQiCMS, the category and content model cannot be changed.This is to ensure the uniformity of the content data structure and the stability of the system.If you really need to change, it is recommended to create a new category and associate the required content model.
2. I added custom fields to the content model, why don't I see these fields on the category editing page?Make sure the custom field you add is for the "category" rather than just for the "document".In the content model, the custom field settings area clearly distinguishes whether it is applied to documents (archive) or categories (category).If you add fields applied to the document to the model, they will appear on the document editing page and will not be displayed on the category editing page.
How to loop through all custom fields of a category in a frontend template instead of calling them individually?You can use it to{% categoryDetail extras with name="Extra" %}The way to get an array or map (depending on your configuration) that contains all custom fields, then use{% for field in extras %}Loop throughfield.Name(field name) andfield.ValueThis field value is displayed. This method is especially suitable for scenarios with a large number of custom fields or when dynamic rendering in templates is required.