AnQiCMS content model secrets: Build a dedicated content display structure for you

In the world of content management, website content is not monotonous.The structure and fields of a blog post are often quite different from the description of an e-commerce product page or the presentation of corporate event information.The traditional CMS system may only provide fixed article or page templates. Once the business needs change, the website seems to be inadequate and difficult to respond flexibly.However, AnQiCMS solves this pain point with its 'flexible content model' feature, allowing you to deeply customize the display structure and fields of website content according to your actual business needs, thus achieving more accurate and personalized content management.

Why is the content model so important?

Imagine if you run a real estate website, in addition to the basic 'article title' and 'article content', you also need to add exclusive fields such as 'apartment type', 'area', 'orientation', 'price', and 'location area' for each property.If only relying on traditional rich text editors to fill in this information, not only is the data entry efficiency low, worse still, when users browse, these key pieces of information are buried in a mass of text and are difficult to obtain at a glance.To further explain, search engines also fail to understand these unstructured data well, which affects the SEO performance of the website.

The flexible content model of AnQiCMS is exactly designed to solve these problems.It allows you to create dedicated data structures for different types of content, just like building with blocks.

  • Achieve precise classification and management of content:Separate different types of content (such as articles, products, services, cases, activities, etc.) clearly, each with its unique set of properties.
  • Improve the efficiency of content entry:The content editor only needs to fill in the information according to the preset fields, avoiding format confusion and missing key data, which greatly improves work efficiency.
  • Optimize user experience:Visitors can quickly locate and filter the information they are interested in, making the content display more organized and professional.
  • Enhance SEO performance:Structured data is easier for search engines to understand and crawl, which helps improve the search ranking of the website.

The 'Flexible Content Model' of AnQiCMS: From Concept to Practice

So, how do we make use of this powerful feature to customize content in AnQiCMS specifically?

Firstly, you need to enter the AnQiCMS backend management interface.Under the 'Content Management' module in the sidebar, you will find the option 'Content Model'.AnQiCMS default provides “Article Model” and “Product Model” two basic content models, which can be used as the starting point for creating new content types, or can be directly modified.

Field Customization: Inject vitality into your content

Click on any content model (or create a new model), and you will see the list of fields included in that model.This is the core area for customizing the content structure.You can add unique custom fields to the model, each field carrying specific information.

When adding or editing fields, there are several key settings that we need to pay attention to:

  • Parameter name (display name):This is the name displayed in the background content editing interface, which should be clear and understandable for content editors. For example, 'author', 'product price', 'floor area', and so on.
  • Field call:This is the unique identifier used to call the content of this field in the template.It must be in English lowercase letters and unique throughout the site, because the template retrieves and displays data through this identifier.author.
  • Field Type:AnQiCMS provides various field types to adapt to different data formats:
    • Single-line text:Suitable for short text information, such as “author name”, “brand name”.
    • Numbers:Applicable to numerical data, such as 'price', 'inventory', 'number of rooms'.
    • Multi-line text:Applicable to scenarios requiring longer text descriptions, such as 'product features', 'detailed introduction'.
    • Single choice:Provide multiple preset options, but only one selection is allowed, for example, 'Color' (red, green, blue).
    • Multiple selection:Provide multiple preset options and allow multiple selections, for example, "Product Features" (waterproof, dustproof, fast charging).
    • Dropdown selection:Similar to single selection, presented in the form of a dropdown menu, saving page space, such as 'Origin', 'Size'.
  • Mandatory:Can set whether this field is required to be filled in when content is published, which helps ensure the completeness and standardization of the content.
  • Default value:Set a default value for the field, which can be automatically filled when the content is created, further improving efficiency. This is especially useful for fields of single-choice, multi-choice, and drop-down selection types, where it is used to define the possible option values.

Content Entry: Custom Field Stage

When you add or edit articles, products, or any other content created based on a custom content model in the background, in addition to the usual options such as title, content editor, categories, etc., you will see all the customized custom fields for that model in the 'Other Parameters' area.The content editor only needs to fill in the information step by step here, and the system will perform corresponding verification and storage based on the field type. The whole process is intuitive and efficient.

Template Invocation: Let the Content Model Present Glamorously on the Front End

The backend content model and field settings are all for the ultimate purpose of displaying to users on the website front end.AnQiCMS's template tag system perfectly connects the backend data with the frontend display.

In the template file, you can call the data of custom fields in the following way:

  1. Directly call specific fields:If you know the exact name of the "Call Field" of the custom field, you can use it directly.{{archive.你的调用字段名}}to get it. For example, if your article model has customizedauthorField, then you can display the author like this in the article detail page template:

    <p>作者:{{archive.author}}</p>
    

    For product models, if you have customizedpriceField, then you can display it like this:

    <p>价格:{{archive.price}} 元</p>
    
  2. Loop through all custom fields:有时,你可能希望动态地展示所有自定义字段,或者不确定每个内容的具体字段名称。AnQiCMS提供了archiveParamsTags, allowing you to loop through all custom fields of the current content model and display their "parameter name" and "parameter value" one by one.

    {% archiveParams params %}
    <div>
        {% for item in params %}
        <div>
            <span>{{item.Name}}:</span>
            <span>{{item.Value}}</span>
        </div>
        {% endfor %}
    </div>
    {% endarchiveParams %}
    

    This method is especially practical in scenarios such as displaying product parameter lists, service details, etc. It can automatically adapt to the increase or decrease of background fields without frequent modification of front-end code.

Through these flexible