How to customize the content model in AnQiCMS to meet personalized needs?

Calendar 👁️ 68

As a website operator who is well-versed in Anqi CMS, I know that flexible content management is the key to improving user experience and achieving personalized operation.The powerful functions of AnQi CMS in content model customization are the core weapons that enable us to meet various business needs effortlessly.Today, I will give a detailed explanation of how to customize the content model in AnQiCMS to meet your personalized needs.

The core role of the content model in AnQiCMS

In AnQiCMS, the content model is the foundation for organizing and managing website content.It defines the structure and properties of a certain type of content, for example, an article should include the title, author, publish date, etc., while a product may include the product name, price, inventory information, etc.The Anqi CMS is default built-in with two general models, 'Article Model' and 'Product Model', which cover most of the basic content needs of most websites.However, for specific industries or business scenarios, such as real estate websites needing 'property model', e-commerce platforms needing more detailed 'product model', educational institutions needing 'course model', etc., these default models clearly cannot meet the storage and display of personalized data.

It is precisely to meet the needs of this diversified content structure that AnQiCMS provides a highly flexible content model customization function.Through this feature, you can freely create and expand content types based on your own business logic, ensuring that each piece of content can be managed in the most fitting way according to its attributes, greatly enhancing the adaptability of the system and the efficiency of content operations.

Flexible customization of value embodiment

The value of a customized content model is far more than just storing more types of data.It is directly related to the professionalism of your website content, user experience, and future scalability.Imagine that if you run a used car trading platform and do not have a dedicated "vehicle model", you may need to pack the key information such as "brand", "model", "mileage", "displacement" and so on into some general field of the article, or directly write it into the text.This makes data management chaotic and also makes front-end display, search filtering, and data statistics extremely difficult.

By customizing the content model, you can precisely define unique fields for each special content type.This way, content entry will be more standardized, and operation personnel can clearly see the use of each field;When displaying on the front end, layout and style control can be refined according to custom fields;When retrieving data, it can also be efficiently filtered and queried based on specific fields.This refined content management will directly translate into a better user experience and more efficient operational processes.

Gradually create and define a personalized content model

To start customizing your content model, you first need to enter the AnQiCMS backend management interface.

You can find the 'Content Management' module in the left navigation bar of the background, click to enter, and you will see the option for 'Content Model'. This is the center where you manage all content models.

On the content model management page, you will see the built-in 'article model' and 'product model'.To create a brand new custom model, you need to click the corresponding 'Add Model' button.

When creating a new model, some basic information needs to be filled in:

  • Model nameThis is the Chinese name you identify the model in the background management interface, for example, "housing", "course", "recruitment position", etc. It is used for user interface display and navigation in the background.
  • Model table nameThis is a key internal identifier that defines the table name where the model content data is stored. The name must beEnglish lowercase lettersIt is unique in the system. For example, if you create a "property model", the model table name can be set tohouse_listingPlease note that once set, it is not recommended to modify it arbitrarily to avoid data confusion.
  • URL aliasThis field will be used for the composition of your website's front-end URL, usually displayed in pseudo-static rules. It must also beEnglish lowercase letterssimple and clear. For example, the housing model can usehouseAs a URL alias, the URL of the relevant page may contain/house/.
  • Title NameThis is the prompt text for the content title when you publish the model content.For example, when creating a "product model", it can be set to "product name", so that when the product is published, the title field will display "product name" as a prompt.

After completing the basic information entry, the next step is to define the exclusive fields of the model.This is the core of implementing personalized content. On the model editing or new page, there will be a section called "Custom fields of content model".Click “Add field”, you can add any number and type of fields to the model:

  • Parameter NameThis is the display name of the field in the background management interface, which is convenient for operation personnel to understand and fill in, such as 'number of bedrooms', 'course duration', 'workplace', and so on.
  • Field invocationThis is the unique identifier you use to call this field data in the template. It must beEnglish lowercase lettersAnd it is unique within a model. For example, the field for 'number of bedrooms' can bebedrooms,'course duration' can beduration.
  • Field type: AnQiCMS provides various field types to adapt to different data formats:
    • Single-line text: Suitable for short text input, such as names, titles, and brief descriptions.
    • Number: Only numeric input is allowed, suitable for prices, quantities, areas, etc.
    • Multi-line text: Suitable for long text input, such as detailed introductions, notes, etc.
    • Single choiceProvide preset options that the user can choose from, such as 'Gender' (male, female), 'House Type' (apartment, villa).The option values are entered one by one through the "Default Value" field.
    • Multiple selections: Provide preset options that the user can select multiple, such as "House Features" (furnished, with a balcony, close to subway).The option values are also entered one per line in the 'Default Value' field.
    • Drop-down selection: Similar to single selection, but presented in a dropdown menu format, saving page space, suitable for situations with more options, such as "city", "province".Enter the values for the 'Default Value' field one per line.
  • Mandatory?You can specify whether this field is required when the content is published.
  • Default valueSet the default value for the field. This is where you define all options for radio, checkbox, and dropdown selection types, one per line.

For example, to create a "property model", we can define the fields like this:

  • Model name: Property
  • Model table name:property_listing
  • URL alias:house
  • Title name: Property title

Custom field:

  • Parameter name: Number of bedrooms, field name: bedrooms, field type: number
  • Parameter name: number of bathrooms, calling field:bathrooms, field type: number
  • Parameter name: floor area (square feet), calling field:area_sqft, field type: number
  • Parameter name: property type, calling field:property_typeField type: Dropdown selection, default value: Apartment Villa Townhouse
  • Parameter name: Price, field used:price, field type: number
  • Parameter name: Address, field used:addressField type: Single line text

With such a definition, our 'property model' has highly structured exclusive data fields.

Use custom models in content publishing

After you define and save the new content model, the custom fields will appear accordingly on the "Content Management" page below "Add Document" or "Document Category".

When adding a document, you first need to select the category the content belongs to.It should be noted that each category must and can only be bound to one content model.After you select a category bound to a custom model, the "Other Parameters" collapse box on the page will dynamically display all the custom fields of the model for you to fill in according to the actual content.For example, if you select the "property" category, you can fill in the number of bedrooms, bathrooms, address, price, and other exclusive information in the background.

Display custom data in the front-end template

The most important part of the custom model is how to display these personalized data in the website's front-end template.AnQiCMS powerful template tag system makes this process intuitive.

when you arearchiveDetailOr (document details)archiveListWhen fetching content data in the (document list) tag, the custom fields of the model will be used asitem(or the property name you define) to use.

To display a specific custom field, you can access it directly using dot notation, for example, to display 'Number of Bedrooms':{{item.bedrooms}}(In the list loop){% archiveDetail with name="bedrooms" %}(In the detail page)

If you want to display a list of all custom fields (such as for the product parameter table), you can usearchiveParamsLabel. It allows you to iterate over all custom parameters of the model:

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

This code will output the 'parameter name' and corresponding 'parameter value' of each custom field.

Furthermore,archiveFiltersThe tag provides the function to filter content on the front end according to custom fields.This is very useful for implementing complex search or category filtering pages.For example, users can filter the list of listings by 'property type' or 'number of bedrooms'.

{# 参数筛选代码,结合archiveList分页列表使用 #}
<div>
    <div>房源筛选条件:</div>
    {% archiveFilters filters with moduleId="您的房源模型ID" allText="不限" %}
        {% for item in filters %}
        <ul>
            <li>{{item.Name}}: </li>
            {% for val in item.Items %}
            <li class="{% if val.IsCurrent %}active{% endif %}"><a href="{{val.Link}}">{{val.Label}}</a></li>
            {% endfor %}
        </ul>
    {% endfor %}
    {% endarchiveFilters %}
</div>

By combining these tags, you can flexibly display the data of your custom model on any page, achieving highly personalized content display.

**Practice and Precautions

When customizing the content model, there are several**practices worth noting:

  1. Plan ahead: Be sure to plan in detail the content type and fields required before creating the model and fields. Clear planning can avoid unnecessary modifications and data migration work later.
  2. Field naming specificationThe 'model_table_name' and the 'call_field' of the custom field are recommended to use full lowercase letters and underscores (snake_case) for naming, for examplehouse_listingorarea_sqftThis helps maintain the uniformity of the code and avoid potential conflicts.
  3. Choose field types reasonably.Select the most appropriate field type based on the actual data type (for example, use numeric type for price instead of text), which not only ensures data accuracy but also facilitates subsequent data processing and calculation.
  4. SEO-friendlyWhen customizing URL aliases, choose descriptive and concise English words, which is very helpful for search engine optimization (SEO).
  5. Performance considerationAlthough the Go language foundation of AnQiCMS ensures high performance, overly complex models or a large number of custom fields may still have a slight impact on database performance.When designing, it should weigh the personalized needs of content and the overall performance of the system.
  6. Thorough testing: Before using a custom model in a production environment, it is essential to perform thorough content entry, front-end display, search filtering, and other tests in a test environment to ensure that all functions work properly.

By mastering the AnQiCMS content model customization features, you will be able to fully control the structure and display of website content. No matter how special your business is, AnQiCMS can provide strong and flexible support to help you build a website that truly meets your personalized needs.


Frequently Asked Questions (FAQ)

1. What impact will it have if I modify or delete a custom content model?

When modifying an existing model field, if it is only adjusting the field name or display order, it usually will not affect the existing data.If you change the 'call field' or 'field type', or delete a field, the existing content data associated with that field may be lost or may not display correctly.AnQiCMS will prompt you to delete the model, and all documents and categories under the model will also be deleted. Therefore, you must be cautious before performing such operations and make sure to back up your data.

2. Can I reference or use a custom field of another content model in a content model?

In AnQiCMS, the design of the content model is relatively independent.Each content model's custom field belongs only to itself. You cannot directly reference a custom field defined in another model within the content of a model.If you need to implement the association between different model content, you usually do so by linking documents, categorizing associations, or through templates.archiveListTags are queried and displayed across models based on ID, category, and other conditions.

Will creating a large number of custom content models and fields affect website performance?

AnQiCMS is developed in Go language and has the characteristics of high performance and high concurrency. Usually

Related articles

How to implement unified operations for the multi-site management function in AnQiCMS?

As a website operator who has been deeply involved with AnQiCMS for many years, I am well aware that in today's complex network environment, enterprises and content creators often need to manage multiple brand sites, sub-sites, or independent platforms established for different markets and user groups in different languages.The multi-site management function of AnQi CMS is specifically designed to meet such needs, it not only simplifies the cumbersome operational processes, but also provides strong support at the level of unified operations.### AnQiCMS

2025-11-06

How can AnQiCMS help small and medium-sized enterprises and content operation teams improve efficiency?

## AnQi CMS: A powerful tool to help small and medium-sized enterprises and content operation teams achieve efficient growth In today's digital wave, small and medium-sized enterprises and content operation teams are facing increasingly growing challenges in content management.From how to efficiently create, edit, and publish content, to how to improve the visibility of content in search engines, and how to effectively manage multi-site and multi-language content, every step tests the team's operational efficiency and market competitiveness.AnQiCMS (AnQiCMS) is an enterprise-level content management system designed to address these pain points, and it relies on its simple and efficient architecture and rich practical functions

2025-11-06

What are the core features and highlights of AnQiCMS?

As an experienced website operator, I have a deep understanding of the powerful functions of AnQiCMS and the actual value it brings to small and medium-sized enterprises, self-media operators, and multi-site managers.AnQiCMS is an enterprise-level content management system developed based on the Go language, and its design philosophy always revolves around providing an efficient, customizable, and easy-to-expand content management solution.It not only helps users simplify the content publishing process, but also helps websites stand out in the fierce market competition through a series of refined functions.

2025-11-06

How to format a timestamp to a specified datetime using the `stampToDate` filter in AnqiCMS template?

In the daily operation of AnQi CMS, the precise presentation of content is a key link to improve user experience and website professionalism.The formatting of dates and times is an indispensable part of it.As an experienced website operations manager, I am well aware of the readers' requirements for clear and consistent information.To help everyone better utilize the AnqiCMS template functions, this article will detail how the `stampToDate` filter formats timestamps into specified date and time in AnqiCMS templates.

2025-11-06

How does AnQiCMS multilingual support help enterprises expand into the international market?

Hello! As a website operator familiar with AnQiCMS and proficient in content operation, I am very willing to deeply analyze how AnQiCMS's multilingual support can provide strong assistance for enterprises to expand into the international market.In the current global business environment, multilingual websites are no longer an optional choice, but a key step for enterprises to go international and seize global opportunities.AnQiCMS is precisely aware of this need, through its carefully designed multilingual feature, helping enterprises overcome language barriers and directly reach target customers worldwide.Build the foundation for globalization

2025-11-06

How to optimize the SEO performance of AnQiCMS's pseudo-static and 301 redirect?

As an expert who deeply understands the operation of AnQiCMS and website operation, I know the key role of search engine optimization (SEO) in website visibility and user acquisition.Among the many powerful features of AnQiCMS, pseudo-static (URL rewriting) and 301 redirect management are undoubtedly two great tools for improving website SEO performance.They not only provide clear guidance for search engines, but also optimize user experience, jointly building a solid foundation for the website in the digital world.

2025-11-06

How can you efficiently use AnQiCMS's content collection and batch import features?

As an experienced website operator who deeply understands the operation of AnQiCMS, I know the importance of high-quality content in attracting and retaining users.In daily work, we must not only carefully create original content, but also make good use of tools to improve efficiency, especially in the face of frequent updates of industry information or when it is necessary to quickly build a large amount of content.AnQiCMS provides the content collection and batch import function, which is the tool for our efficient operation.

2025-11-06

What advanced SEO tools does AnQiCMS provide to improve website visibility?

As a website operator who has been deeply involved in AnQiCMS for many years, I know that high-quality content and excellent website visibility are the foundation for attracting and retaining users.AnQiCMS is not just an efficient content management system, it is more like a carefully crafted SEO toolkit that provides us with many advanced features to help websites stand out in search engines.AnQiCMS has integrated SEO-friendliness into its system architecture, aiming to help small and medium-sized enterprises and content operation teams improve their website's performance in search results.Through practice

2025-11-06