AnQiCMS provides excellent flexibility in content management, with the core being the tight integration of content model and classification.Understanding how to specify the content model for a particular category and use it to influence the display of its documents is the key to the efficient operation of a website.This not only helps organize your website content in an orderly manner, but also allows for diverse frontend display methods to meet different business needs.
Understanding the relationship between content models and categories
Firstly, let us clarify the concepts of 'Content Model' and 'Category' in AnQiCMS.The content model can be considered as the 'skeleton' or 'structure definition' of content, which allows you to customize the fields of content according to business requirements, for example, an 'article model' may include title, author, content, publication date, etc., while a 'product model' may have product name, price, inventory, product parameters, etc.By customizing the content model, structured storage of content can be ensured.
Categories are used to organize and classify content hierarchically.It gathers documents with similar topics or properties.In AnQiCMS, after a category is created, it must specify the content model it belongs to, and once specified, this content model is fixed and cannot be changed.This means that at the initial stage of creating categories, you have already decided the content structure that documents under this category and all its subcategories will follow.This design concept ensures consistency of content, and also provides a foundation for the differentiation of front-end display.
How to specify the content model for categories
In AnQiCMS backend, the operation process of specifying content models for categories is very intuitive.When you enter the 'Content Management' under the 'Document Category' feature, whether you add a new top-level category or edit an existing category, the system will provide an option for you to select its 'Document Model'.
具体操作是:在新建顶级分类时,你会看到一个下拉菜单,列出了所有已定义的内容模型(如默认的“文章模型”和“产品模型”,以及任何自定义的模型)。You only need to select a model that best fits the content attributes of this category.Once confirmed and saved, this category and all future subcategories added to it will be automatically bound to this content model, and document entry and management under it will be based on this model.
How does the content model affect the entry of documents
The binding of categories and content models directly affects the document entry experience.When you select a category bound to a specific content model to add a new document, the AnQiCMS document editing interface will automatically load the preset fields of the content model.
For example, if you select a category bound to a "Product Model", the document editing interface will automatically display "Product Name" (corresponding to the title field of the content model), "Price", "Stock" and other product-specific fields.In addition, if other fields are customized for the "Product Model" in the "Content Model", such as "Product Model", "Color", "Material", etc., these customized fields will also be displayed in the "Other Parameters" collapsible box in the document editing interface, for you to fill in the corresponding information.This intelligent field loading mechanism greatly improves the efficiency and accuracy of content entry, ensuring that each document follows the preset structure.
How does the content model affect the display style of documents (template level)
The association between classification and content models will ultimately be reflected in the document display on the website's frontend.AnQiCMS through flexible template mechanisms, allows you to precisely control the display styles of different content model documents.
Firstly, AnQiCMS follows a set of default template naming conventions. For example, if your content model table name isarticle, the system will try to findarticle/list.htmlAs the default template for the classification list page of the model,article/detail.htmlthe default template for the document detail page below. Similarly, if it is aproductmodel, it will correspond to,product/list.htmlandproduct/detail.htmlThis means that even without any additional configuration, AnQiCMS can automatically match and load the corresponding general template according to the content model.
However, the strength of AnQiCMS lies in its high degree of customization. You can customize templates at multiple levels:
Customize category templates:In the 'Document Classification' editing interface, you can specify a 'Classification Template' and a 'Document Template' for a specific category.
- Category Template:It will affect the list page layout of the category itself, for example, you can make the list page of the "News Center" category and the list page of the "Product Display" category have different styles.
- Document templateIt will affect the layout of the detail pages of all documents under this category.For example, you can specify a template with code highlighting for all documents under the "Technical Articles" category, and a simple template for documents under the "Company News" category.You can also select 'Apply to child categories', so that lower-level categories automatically inherit this setting to avoid repeated configuration.
Document-level custom template:For some documents, if you want them to have a unique display style, you can set 'Document Template' in the 'Publish Document' interface to achieve the most granular personalized display.
Using template tags to display content model fields:This is the core manifestation of the flexibility of AnQiCMS templates. AnQiCMS provides a rich set of template tags, allowing you to accurately call data from the content model, including those custom fields:
- Pass
{% archiveDetail with name="字段名称" %}Label, you can directly obtain any field value of the document on the document detail page, including the fields you customize in the content model. For example, on a product detail page, you can call the product model like this:{% archiveDetail with name="productModel" %}. - For those parameters that are not fixed or need to be dynamically displayed
{% archiveParams params %}Label to iterate over all custom parameters of the current document and loop to display their names and values. This is particularly useful when displaying product specifications or additional information of articles. The code example is as follows:{% archiveParams params %} {% for item in params %} <div> <span>{{item.Name}}:</span> <span>{{item.Value}}</span> </div> {% endfor %} {% endarchiveParams %} - Other like
archiveList(Document list)、categoryDetail(Category details) These tags can also retrieve and display basic data related to the model.
- Pass
Through closely integrating the content model with classification, and utilizing multi-level template customization and powerful template tags, AnQiCMS makes website content management highly structured and easy to customize.Whether it is to create product lists in bulk, publish professional articles, or display corporate news, it can ensure data consistency and diverse display.This flexible mechanism not only improves the efficiency of content operation, but also provides a solid foundation for the personalized design of the website's front end, thereby better meeting user needs and search engine optimization (SEO).
Common Questions (FAQ)
Q: Can I change the content model to which the category belongs after creating it?A: Cannot.Once the content model for a category is specified and saved, this binding relationship is fixed and cannot be modified in the background.Therefore, when creating categories, please make sure to carefully select the appropriate content model.
Q: If I have not specified a custom template for a category or document, which template will AnQiCMS use to display the content?A: If no custom template is specified, AnQiCMS will automatically search for the default template file based on the table name of the content model. For example, if the content model table name is
articleThe system will default to usingarticle/list.htmlAs the list page template,article/detail.htmlAs the detail page template. This default mechanism ensures that content can be displayed normally even without personalized settings.Q: Can I display content from different content models on the same page?A: Of course. AnQiCMS template tags are designed to allow you to use them in any template file by specifying
moduleIdParameters, flexible to call document lists or details from different content models. For example, in a home page template, you can use{% archiveList archives with moduleId="1" %}Call the article list, and then{% archiveList products with moduleId="2" %}Call product list, realize the mixed display of content.