An efficient and customizable content management system, AnQi CMS has one of its core advantages being a flexible content model.This provides website operators with great flexibility, allowing us to design unique structures and display methods for various content types such as 'articles' and 'products' according to different business needs, thus achieving personalized presentation of website content.

Next, we will delve into how to take advantage of the powerful functions of the Aqii CMS to achieve personalized display of the content model.

Understanding the content model of Aqii CMS

In the Auto CMS, the content model is the skeleton that defines the structure of a certain type of content data.It determines which fields can be filled in and what types of fields are available when we publish and manage content in the background.System provides "auto" article model and "auto" product model, each with a set of basic fields preset to meet the basic needs of article and product publishing.

However, the website content is often more than this.For example, a real estate website may need a "property model" that includes "apartment typeThe Anqi CMS allows us to fully customize new content models and add exclusive custom fields to each model, which is the first step in achieving personalized display.

核心策略一:利用自定义字段丰富内容结构

The personalized display of content depends first on whether the structure of the content is rich and accurate.The custom field feature of AnQi CMS allows us to add unique data items based on the specific characteristics of each content model.

比如,对于文章模型,除了标题、正文、发布时间等基础字段,我们可能还会添加:

  • 作者English: Single-line text, records the author of the article.
  • SourceEnglish: Single-line text, indicates the original source link or name of the article.
  • Reading Time:Number type, estimated time readers need to finish reading the article.
  • recommendation attributes:Multiple choice, such as 'Top News', 'Recommendation', 'Slideshow', etc., convenient for calling and displaying in different areas.

And forProduct modelTo better display product features, we can add:

  • Product model: Single-line text, precise product code.
  • price: Numeric type, product's sales price.
  • inventory:Digital type, the current available inventory of the product.
  • Main features:Multi-line text, highlighting the core advantages of the product.
  • Parameter list:Multi-line text for inputting detailed technical parameters of the product, which can be parsed into a table on the front-end.
  • Product Album:Type of group image, upload multiple product images to form a carousel effect.

How to operate?In the AnQi CMS backend, you can find the 'Content Model' option under 'Content Management'.Here, you can modify existing models (such as articles, products) or “add a new model”.In the model editing interface, you can add "custom fields" to the model.Each field can be set with parameters such as parameter name (front-end call name), field type (single-line text, number, multi-line text, single selection, multiple selection, dropdown selection, etc.), whether it is required, and the default value.productModel.

These custom field settings directly determine what information we can fill in when publishing content on the backend, and also lay the data foundation for the personalized display on the front end.

核心策略二:为不同内容模型定制专属模板

With structured content, the next step is how to present them on the frontend page in a way that conforms to their type.The template system of AnQi CMS provides high flexibility, allowing us to customize exclusive display templates for different content models, even specific categories or single pages.

安企CMS的模板文件通常以 English.html为后缀,并存放在 English/templateThe directory. Its template syntax is similar to Django template engine, through{{变量}}output data,{% 标签 %}perform logical control.

The system supports custom template names and can be automatically applied. For example:

  • The default template for the article detail page may bearticle/detail.html.
  • The default template for the product detail page may beproduct/detail.html.
  • The default template for the article list page may bearticle/list.html.
  • The default template for the product list page may beproduct/list.html.

In addition, more refined personalized control lies in the fact that we canSpecific categoryorsingle contentspecify the use of independent template files:

  • In the "Document Classificationnews/list.htmlso that it matches the style of the "Industry Information"industry/list.htmldisplay.
  • When adding a document or a product, you can specify a 'document template' under 'other parameters', for example, for a special product,special_product/detail.html,to have a completely different details page layout from ordinary products.
  • The single page can also customize the template, such as specifying for the "Contact Us" pagepage/contact.html.

How to operate?Firstly, you need to/template/您的模板目录Create the corresponding template file, for examplearticle/detail.html/product/detail.html. If you want to specify a unique template for a category or document, for examplespecial_product/detail.htmlIf so, simply create the file. Then, when editing the category or document in the background, enter the corresponding filename in the "Category Template" or "Document Template" field (such asspecial_product/detail.html),System will load the corresponding template according to your settings.

Core strategy three: skillfully use template tags and filters to display personalized content

With custom fields and dedicated templates, you ultimately need to extract the data through specific tags and filters and present it in a beautiful and practical way.

1. Extract content model data:archiveDetailandarchiveListThese tags are the core to retrieve data for articles, products, and other content.

  • {% archiveDetail with name="Title" %}Can retrieve the title of the current content.
  • `{% archiveDetail with name=“English” %