Unlock content potential: Utilize AnQi CMS flexible content model to customize display structure

In today's rapidly changing digital world, website content is no longer just simple articles and pages.For many operators, it may include a variety of products, engaging activities, professional and detailed project cases, and even unique team member introductions.Traditional Content Management Systems (CMS) often use fixed content structures, causing diverse information to be crammed into the boxes of "title" and

AnQi CMS was born to solve this pain point. It provides an extremely flexible content model, allowing us to customize the structure and display of each type of content according to actual business needs, just like building with blocks.This is not just the convenience of background data entry, but also a revolutionary improvement in the front-end content presentation effect.

Why is the content model so important?

Imagine you are running an e-commerce website. Traditional CMS might only give you a 'product title' and 'product description' input box.But in fact, a product may also require multiple attributes such as 'price', 'inventory', 'brand', 'model', 'color', 'size', 'material', and more.If this information is all stuffed into the "Product Details", it not only makes management chaotic, but also makes it difficult for users to quickly obtain key information.

Flexible content models allow you to create dedicated data fields for different types of content, just like customizing a set of 'IDs' for each type of content. For example:

  • Product content: Can have fields such as 'price', 'SKU', 'brand', 'image set', 'product specifications', etc.
  • Event content: Can include fields such as "Event Date", "Event Location", "Application Deadline", "Keynote Speakers", etc.
  • Project Case: You can define fields such as "Customer Name", "Industry Field", "Problem Solved", "Implementation Effect" and so on.

This customized content structure can help your website display information more clearly and logically, improve user experience, and even have a positive impact on search engine optimization (SEO), because structured data is easier for search engines to understand and index.

How to implement content model customization in Anqi CMS?

In AnQi CMS, the customization experience of the content model is very intuitive.You can find the 'Content Model' feature through the 'Content Management' on the backend.The system is built-in with "Article Model" and "Product Model", but you can create a new custom model as needed.

Taking the creation of a 'Project Case' model as an example, we need:

  1. Define basic model information: Give the model a recognizable "model name" (such as: project case), and set a "model table name" for database storage and a "URL alias" for URL construction (usually in lowercase English letters).
  2. Add custom fieldThis is the core of the content model. You can add a series of exclusive fields for "project case", such as:
    • Parameter Name(For example: "Customer Name"): This is the friendly name displayed in the backend interface for content editors.
    • Field invocationFor example: "clientName" is the unique identifier used when calling this field in the template. It is recommended to use camelCase naming style.
    • Field type: Anqi CMS offers a variety of field types to match your data needs:
      • Single-line text: Suitable for brief text information, such as 'customer name', 'industry field'.
      • NumberApplicable to numeric data, such as 'project budget', 'completion cycle'.
      • Multi-line textApplicable to longer descriptive text, such as 'pain points solved', 'customer reviews'.
      • Single choice/Multiple selections/Drop-down selection: Data applicable to preset options, such as "Project Status" (in progress/completed), "Type of Collaboration" (B2B/B2C).You can provide a specific list of options in the "default value", one option per line.
    • Mandatory?You can set certain fields as required based on importance to ensure the completeness of the content.

After defining the model and fields, the next step is to apply these models to your content.When creating a "document category", you can choose to bind the category to a specific content model (for example, bind the "project case" category to the "project case" model).This, all the content under this category will follow the field structure defined by the 'project case' model for entry.

Present custom content on the website front end.

After customizing the content model, how to elegantly display this information on the website front-end is the key to personalized display.AnQi CMS adopts the Django template engine syntax, allowing you to easily call these custom fields in template files.

Firstly, you need to understand the organization structure of the template file. The template files of AnQi CMS are usually stored in/templatedirectory, and classified according to the model or page type (for example,{模型table}/detail.htmlUsed to display the details of the model under this model).

When you need to display custom model fields, you can usearchiveDetailandarchiveParamsthese two tags:

  • archiveDetailTagUsed to get detailed information about the current document, including all custom fields. You can directly call by field name. For example, on the detail page of "Project Cases"project/detail.htmlIn Chinese, if you define the 'Customer Name' (called fieldclientName) and the 'Industry Field' (called fieldindustry), you can display them like this:

    <h1>{{ archive.Title }}</h1> {# 默认标题字段 #}
    <div>
        <strong>客户名称:</strong> {% archiveDetail with name="clientName" %}<br>
        <strong>行业领域:</strong> {% archiveDetail with name="industry" %}<br>
        {# 假设还有一个多行文本字段 'solution' #}
        <strong>解决方案:</strong> {% archiveDetail solution with name="solution" %}{{solution|safe}}<br>
    </div>
    <div class="project-content">
        {{ archive.Content|safe }} {# 默认正文内容,记得使用 |safe 防止HTML转义 #}
    </div>
    
  • archiveParamsTagIf you want to loop through all custom fields, or are unsure of the specific field names,archiveParamsIt will be very useful. It will return an array containing all custom parameters, and you can iterate through this array to display.

    <div>
        <h3>项目参数:</h3>
        {% archiveParams params %}
        <ul>
        {% for item in params %}
            <li><strong>{{ item.Name }}:</strong> {{ item.Value }}</li>
        {% endfor %}
        </ul>
        {% endarchiveParams %}
    </div>
    

    This method is particularly convenient when you need to dynamically add or modify model fields without frequently modifying the template.

For fields like 'Multiple Choice' or 'Dropdown Selection' that may return multiple values, you would typically retrieve them as an array and iterate over them in the template to ensure that all options are clearly displayed.

Practical Tips for Optimizing Content Display

Based on custom content structure, Anqi CMS also provides other features to further optimize content display and user experience:

  1. Custom URL static rulesThrough the 'static rule' setting on the backend, you can customize more semantically meaningful and SEO-friendly URL structures for different content models, categories, or documents. For example, set the URL of the detailed page of 'project cases' to be/projects/{filename}.htmlit is no longer simple/article/{id}.htmlThis not only improves user memorability, but also helps search engines better understand the content of the page. You can make use of{module}/{filename}etc. to flexibly construct URLs.

  2. Category template and document templateWhen certain categories or individual documents require a completely different layout or display style, Anqi CMS allows you to specify exclusive template files for them. For example, to specify a template for the "Recruitment Information" category,job/list.htmlA template that allows the list page to display key information such as job salaries, locations, etc.; or specify for an important "About Us" single pagepage/about_us.htmlTemplate, with a unique visual design. This brings the personalized display of content to its peak.

  3. Multilingual content displayIf your website is aimed at international users, the multilingual support feature of AnQi CMS can be perfectly combined with the content model. You can define corresponding fields for different language versions in the content model and throughlanguagesThe label provides language switching options on the front end, ensuring that users in different regions can see content that conforms to their habits.

Conclusion

The flexible content model of AnQi CMS brings unprecedented freedom to your website content management. It frees you from the constraints of traditional CMS, enabling you to precisely define and display each type of content, thus creating