In website content operation, the way content is presented is the key to attracting users, conveying information, and achieving business objectives.AnQiCMS (AnQiCMS) provides a highly flexible custom content model, which is our powerful tool for fine-grained control of the front-end content display of the website.It is not just the background data management, but also the cornerstone of front-end visual and functional experience.

The foundational role of flexible content models

One of the core strengths of AnQi CMS is its 'flexible content model' feature.In simple terms, the content model is a preset structural framework for different types of content.Imagine a product detail page and a news article page, the information fields they require must be different: products need price, inventory, SKU, etc., while news requires author, publishing time, summary, etc.The AutoCMS allows us to customize exclusive data structures for each content type based on actual business needs, which fundamentally solves the problem of the singularity of content structure.

The value brought by this flexibility is self-evident.It allows the system to easily adapt to various content publishing needs, whether it's complex e-commerce products, simple blog articles, or a variety of scenarios such as event registration and team member introductions.By customizing the content model, we can not only accurately store the required information but also lay a solid foundation for the subsequent frontend display.

Build a dedicated content model: from fields to structure

It is an intuitive and powerful process to build a custom content model in AnQi CMS.Firstly, we need to enter the "Content Model" management interface in the background, where we can modify the built-in models of the system and also create new models.

For every content model created, we need to define some basic information, such asModel name(for easy backend identification),Model table name(English, lowercase, used for database storage)、URL alias(Affects the front-end URL structure, crucial for SEO) andTitle name(Indicates the main title field under this model, such as “Product Name” or “Article Title”)。

What's more, we can add a series of models for each oneCustom fields.These fields are the soul of the content model, and they determine what information a specific content type can store.

  • Single Line Text:适用于短文本输入,如产品型号、作者姓名。
  • Number:确保输入的数据是数值,如价格、库存量。
  • Multi-line text:For longer texts, such as product descriptions, event details.
  • Single choice/Multiple choice/Drop-down choice:Provide preset options for standardized input, such as product color (single selection), service scope (multiple selection), and region (drop-down).

When defining these fields, we can also set whether they are 'required fields' and 'default values', which greatly improves the standardization and efficiency of content input.It is these custom fields that give us flexible control over the way we present front-end content.

Content and classification: actual application of the model

After defining the content model, we can use it when adding documents or categorizing documents.When creating a new content (such as an article or a product) and selecting a category for it, the system will dynamically display the corresponding custom fields based on the content model associated with that category.

For example, if we create a content model named “Product Display” that includes fields such as “Product Price”, “Brand”, and “Details Image Set”.When we create a new category and associate it with the "Product Display" model, all content published under this category will be able to see these exclusive fields in the editing interface.This means that different types of content, even though they all belong under the broad category of 'documents', can have entirely different appearances in the backend editing interface and data structure.

Template linkage: Convert data to visual

The final display effect of the content cannot be separated from the support of the template.安企CMS uses syntax similar to Django template engine and follows a clear template convention, allowing us to present the data stored in the custom content model of the backend in various creative ways on the website front-end.

  1. Model-specific template: The AQCMS supports naming template files according to the table name of the content model, for example{模型table}/detail.htmlUsed for the detail page of a single content{模型table}/list.htmlUsed for content list page.This means that we can design a dedicated list and detail layout for the "article
  2. Dynamic call of custom fieldThis is the core of the interaction between the custom content model and the front-end display. We can use{% archiveDetail with name="字段名称" %}This tag directly extracts the value of any custom field. For example, on a product detail page,{% archiveDetail with name="产品价格" %}The price of the product can be displayed. If the field is multi-image upload (such as “Details Image Set”), we can use{% archiveDetail arcimages with name="详情图片集" %}and then cooperate with{% for img in arcimages %}the loop tag to display all images.
  3. conditions and loopsThe strength of the template language lies in its logical processing capabilities. Through{% if %}Label, we can make conditional judgments based on the value of the custom field, thereby realizing the intelligent display of content. For example, when the inventory fieldStockis greater than 0, display “In stock”; when the activity fieldStatusFor “In progress”, display “Sign up immediately”.{% for %}Looping tags can iterate over multiple choice fields or image galleries, flexibly laying out complex data.
  4. Custom template overrideEven under the same content model, Anqi CMS still provides finer-grained control.For a specific article or category, we can set up a completely independent "document template" or "category template" through the backend settings.article/detail.html, but we have a special article that needs a name fordownload.htmlThe template to display its unique download function, simply specify it for the article in the background, which greatly enhances the personalized display ability of the content.

Through the above mechanism, the custom content model of Anqi CMS not only provides a flexible data structure but is also closely integrated with the front-end template, allowing us to finely control the display method of the website front-end according to the content type, business logic, and even the special needs of individual content, thereby building a diverse website that is both beautiful and practical.


Common Questions and Answers (FAQ)

1. What help does a custom content model provide for the SEO of a website?Custom content models allow us to create more semantically structured content for different types, and can generate corresponding labels for each custom field, which helps search engines better understand the content.For example, setting fields such as 'price' and 'brand' for the 'product' model can generate structured data (such as Schema.org) in the front-end template, thereby improving the search engine's crawling and display effect of product information.In addition, by combining the features such as pseudo static, 301 redirection, and TDK settings of the Anqi CMS, it is possible to generate more friendly and descriptive URLs for each type of customized content, further optimizing SEO performance.

2. After creating the content model, will modifying the field type or name of it affect the existing data?In the Auto CMS, content models can be modified after creation, but operations should be done with caution.Changing the field type (for example, from 'number' to 'text') or the field name ('call field') may cause the corresponding data stored in the existing content to be incorrectly parsed or displayed, or even lost.Therefore, it is strongly recommended to back up the data before making such modifications, and to thoroughly verify in a test environment to ensure that the modifications will not affect the normal operation of the website and the integrity of the data.It should be noted that the built-in models of the system can be modified but cannot be directly deleted; while custom-created models will delete all contents and categories under the model upon deletion, requiring extra caution.

3. I have defined an "article" content model, but some articles require special formatting and features. Can I apply a different layout to a single article?Absolutely.The Anqi CMS provides a flexible template overlay mechanism.When adding a document or editing an existing document, you can find an option named "Document Template" in the "Other Parameters".download.html),even if it belongs to the "article" model, the system will use the template you specified to render the page instead of the default onearticle/detail.html.Similarly, classification can also be achieved by setting the "classification template" to adopt a unified special layout for the content under a specific classification.This enables us to achieve great front-end display freedom while maintaining the structured content model.