How to customize the content model to meet the needs of personalized content display?

Calendar 👁️ 64

Today, with the increasing refinement of content operation, we often find that relying solely on traditional 'article' and 'product' categories is no longer sufficient to meet the diverse content display needs of websites.Every business scenario has its unique attributes and information structure, how to make the website's content management system (CMS) like a considerate tailor, tailor-made for each type of content, is our goal.The flexible content model feature provided by AnQiCMS (AnQiCMS) exactly helps us realize this vision.

Why do we need to customize the content model?

Imagine if your website not only publishes articles and products, but also needs to display real estate information, job vacancies, event schedules, and even team member introductions.Each content type has its own unique fields: real estate may require 'type', 'area', 'price', 'location';Hiring requires "Position Name", "Salary Range", "Location", and "Responsibilities";The event requires "start time", "end time", "location", "participation fee", etc.

If forced to stuff this rich information into a generic "article" template, it not only makes the back-end entry inefficient, but also makes the front-end display appear chaotic and unprofessional.Information cannot be structured, which means it is difficult to perform precise filtering and sorting, and cannot provide clear structured data to search engines, thereby affecting user experience and SEO effects.

The role of custom content models is like providing a brand new framework tailored to the content of your website.It allows us to define exclusive data fields for different types of content, ensuring that each piece of information is collected and displayed in the most reasonable and orderly way.

Create a custom content model in Anqi CMS

In AnQi CMS, creating and managing content models is an intuitive and powerful process.You can go to the "Content Management" section of the backend, find the "Content Model" option.Here, you will see the built-in 'article model' and 'product model' - they are preset general content structures.To meet individualized needs, we usually choose to "add a custom model".

After clicking the 'Add Model' button, you need to define some basic information for the new model:

  • Model name:This is the Chinese name used for identifying and managing models in the background, such as 'Real Estate Information', 'Recruitment Positions'.
  • Model table name:This is the English identifier used by the system when storing data in the database. It is recommended to use lowercase letters and numbers to ensure uniqueness. It determines how the data is organized on the backend.
  • URL alias:Used to generate static links, it is also recommended to use lowercase English letters, which will be part of your content URL and are very important for SEO.
  • Title Name:This is the prompt text for the main title of the content when publishing, such as "Product Name" or "Real Estate Title", making it clear for the content editor.

What follows is the essence of custom content model -Define model fields. Here, you can add custom fields according to your needs.AnQi CMS offers various field types, each like a tiny 'data container' that stores information in a specific format:

  • Single-line text:Suitable for brief text information, such as "property title", "contact phone number", "job position".
  • Number:Only numbers can be entered, suitable for fields such as 'area', 'price', 'salary range', 'inventory quantity' that require numerical calculations or range filtering.
  • Multi-line text:It is suitable for entering longer descriptive text, such as "Real estate details", "Job responsibilities", "Event introduction".
  • Single choice:Allow you to preset multiple options, but the content publisher can only choose one, for example, "House type (residential/commercial/villa)", "Article source (original/reprint)."}
  • Multiple selection:Similarly, multiple options are preset, but the content publisher can choose one or more, such as 'House features (elevator/parking space/school district)', 'Product functions (waterproof/shakeproof/touch screen).'
  • Dropdown selection:Similar to single selection, but presented in the form of a dropdown menu, suitable for situations with many options, such as 'Area (Haidian/Chaoyang/Fengtai)', 'Product Color (Red/Blue/Black)'.

When defining each field, you can also set 'whether it is required' to ensure that key information is not missed;And the "default value", provides convenient preset options for some common fields.These settings greatly enhance the efficiency and standardization of content entry.

Post and manage personalized content

After you create a custom content model and define all fields, it will seamlessly integrate into the content publishing process of AnQi CMS.Under "Content Management", when you select "Add Document" or "Add Product", you will find an important change: you first need to select a "category".

This category is closely related to the model you created. Once you select a category bound to a custom model, in the document editing interface, in addition to the original title, content, keywords, and other general fields, you will see a collapsible area for 'other parameters'.Expand this area, all the custom fields you defined will be listed clearly, waiting for you to fill in the corresponding data.

Such a design ensures that each type of content can be entered according to its unique structure, both standardized and efficient.

Display custom content in the front-end template.

The true magic of a custom content model lies in how it can be flexibly presented on the website front end.The AnQi CMS adopts the Django template engine syntax, allowing you to convert structured data stored in the background into a rich and varied page content through concise tags.

To call the custom model field in the template, several core tags are mainly used, and the most important one isarchiveDetailandarchiveListThey are used to obtain detailed information of a single content and the list of contents. As for the custom fields we define,archiveParamsthe tag is its exclusive "extractor".

For example, when you are on the content detail page (usually correspondingarchiveDetail), you can usearchiveParamsto iterate and display all custom fields:

{% archiveParams params %}
    {% for item in params %}
    <div>
        <strong>{{item.Name}}:</strong>{# 显示字段的中文名称,如“面积” #}
        <span>{{item.Value}}</span>{# 显示字段的值,如“120平米” #}
    </div>
    {% endfor %}
{% endarchiveParams %}

This code will intelligently traverse all the custom fields you have defined for the current content model and display them in the form of "Field name: Field value".This is very useful for pages that need to fully display content properties.

If you know the specific "call field" name of a custom field (for example, if you define a field namedarea), you can also access it directly througharchiveobject:

<div>
    <strong>房屋面积:</strong>
    <span>{{archive.area}} 平米</span>
</div>
<div>
    <strong>装修情况:</strong>
    <span>{{archive.decoration_status}}</span>
</div>

This direct access method allows you to be more flexible when designing specific layouts, and you can embed custom fields precisely into any position of the page element as needed.

Moreover, if you define filterable fields in a custom model (such as the 'type' of real estate), the Anqi CMS'sarchiveFiltersLabels can also help you build powerful filtering functions on the list page.Users can filter content based on these custom fields, greatly enhancing the discoverability and user experience.

The flexible content model of AnQi CMS opens up endless possibilities for website content design. Whether it is to build complex industry portals or create personalized corporate websites, it can provide strong

Related articles

How to implement unified and efficient display of content for multiple sites in AnQiCMS?

AnQiCMS (AnQiCMS) is a content management system tailored for small and medium-sized enterprises and content operation teams, one of its core highlights being excellent support for multiple sites.Under the increasingly prevalent trend of multi-brand and multi-channel operation, how to efficiently manage and display the content of multiple websites on a single platform has become a focus of many users.The Anqi CMS is built around this need, creating a flexible and powerful solution to ensure the consistency of content display and operational efficiency.### Core Pillar

2025-11-08

How to check variable data type and structure for debugging in AnQiCMS template?

During AnQiCMS template development, we often encounter a frustrating scenario: the page display does not meet expectations, and the data of some variables cannot be output correctly.At this time, we urgently need a 'fire-eyed golden eyes' to see through the real data type and internal structure of the template variables.AnQiCMS's powerful Django-like template engine is flexible, but if you cannot clearly understand the 'true face' of variables during debugging, the efficiency will be greatly reduced.Luckyly, AnQiCMS provides us with a series of practical tools

2025-11-08

How do the `center`, `ljust`, and `rjust` filters control the alignment of a string within a specified width?

In website content management, we often need to present text in an orderly and beautiful manner, especially when dealing with specific layouts or content that requires structured display.AnQiCMS's template engine provides several very practical string filters, specifically used to control the alignment of text within a fixed width. They are `center`, `ljust`, and `rjust`.Understand and make good use of them, which can help us control the display effect of the front-end page more finely.### Center the string with `center`

2025-11-08

How to use the `escapejs` filter to safely embed template variables into JavaScript code?

In the daily use of AnQi CMS, we often need to display the content of the background management, such as article titles, user comments, or other dynamic data, on the front-end page.This content is not just plain text, it also needs to be used in JavaScript code, such as variable values, function parameters, or dynamically generated HTML fragments.However, embedding template variables directly into JavaScript code, if not handled properly, may introduce a significant security vulnerability - cross-site scripting (XSS)

2025-11-08

How to display multilingual content and switch on the AnQiCMS website?

In today's increasingly globalized world, many companies hope that their websites can serve users from different language backgrounds.AnQiCMS (AnQiCMS) understands the importance of this requirement and has integrated powerful multilingual support capabilities into the system design from the beginning, helping you easily build and manage multilingual websites. To display multilingual content on your AnQiCMS website and allow users to switch between languages, this primarily revolves around its "multi-site management" core function.The Anqi CMS treats each language as an independent site for management

2025-11-08

How to optimize the URL structure to make the content result page more conducive to search engine crawling and display?

In content operation, a well-structured, search engine-friendly URL (Uniform Resource Locator) not only improves user experience but is also the key to helping search engines efficiently crawl and understand website content.AnQiCMS (AnQiCMS) knows this, and therefore built-in powerful URL optimization features in the system design, so that the content result page performs better in search engines.### URL Optimization Basics of AnQi CMS: URL Rewriting By default, many dynamic websites' URLs contain question marks, equal signs, and a long string of difficult-to-understand parameters, such as `example

2025-11-08

How to configure pseudo-static rules to achieve diverse content link display modes?

As website operators, we all hope that the website's URL can be easily indexed by search engines and be clear to users, even allowing them to understand the content of the page directly from the link.A clear and meaningful URL not only enhances user experience but is also an indispensable part of search engine optimization (SEO).Aqin CMS understands this and therefore provides a powerful and flexible static rule configuration function, allowing us to create diverse content link display modes according to our needs.Why is pseudo-static so important?\n\nImagine two types of links: `www.yourdomain

2025-11-08

How to add recommended attributes to articles, products, and display them in front-end categories?

In content operation, how to effectively highlight important information so that users can find the core content at a glance, which is the key to improving the website effect.AnQiCMS (AnQiCMS) provides a flexible recommendation feature that allows you to easily mark the importance of articles, products, or other content and display them on the website front-end as needed.This article will introduce in detail how to add these recommended attributes to the content in the background, as well as how to classify them in the front-end template.--- ## Use Anq CMS recommended attributes to make your content shine on the front page In content management and presentation

2025-11-08