How to use a flexible content model to customize the front-end content display structure?

Calendar 👁️ 71

AnQi CMS provides a very powerful core feature in content management, that is, its 'flexible content model'.This is not just about allowing us to publish traditional articles and product information, but more importantly, it gives us the ability to customize any content structure and display it in the way we want on the website front-end.

Understand the core value of the flexible content model

In traditional CMS, we are often limited by predefined content types, such as only being able to publish "articles" and "products", which seems inadequate when facing diverse business needs.For example, if you operate a real estate information website, you may need to publish 'project details', which includes floor plans, area, location, surrounding facilities, and other specific fields;If you manage a registration platform for events, you may need to create 'event' content, including event time, location, maximum number of participants, speaker, etc.

The flexible content model of AnQi CMS is designed to solve this pain point.It allows us to break out of the inherent framework of 'articles' and 'products', creating a completely customized content structure based on actual business needs.This means we can define the fields required for each content type, whether it's text, numbers, single-choice, multiple-choice, or image groups, allowing the system to flexibly support this, thereby greatly enhancing the efficiency of content management and the adaptability of the website.

Create your exclusive content model

To begin customizing the display structure of front-end content, the first step is to create or modify the content model.You can find the 'Content Model' option under the 'Content Management' menu in the Anqi CMS backend.The system provides the default "Article Model" and "Product Model", but the real strength lies in the ability to create completely new models based on your business logic.

When creating a new model, you need to set some basic information, such as the model's "name" (for example, "real estate", "event"), and the model table name (used for database storage, it is recommended to use English lowercase letters, such ashouseoractivity) and "URL alias" (used for static URLs, also recommended in lowercase English).

The most important thing is to add a 'custom field' to your model.This is the core embodiment of the flexibility of the model. Anqi CMS provides a variety of field types to meet the vast majority of content needs:

  • Single-line text/multiline text:Suitable for short text descriptions or long introductions.
  • Number:Applicable to pure numeric information such as price, quantity, and area.
  • Single choice/Multiple choice/Dropdown choice:Applicable to preset options, such as the 'type' of property (one-bedroom, two-bedroom), and the 'difficulty level' of activities (beginner, intermediate, advanced).You can set these options in the "Default Value".

By these fields, you can build a content structure that matches your business logic.For example, add fields such as 'house type' (drop-down selection), 'area' (numeric), 'geographical location' (single-line text), 'facilities' (multiple choices), and others to the 'real estate' model.

Associate content with model

After creating the content model, you need to associate it with actual content through "Document Classification".When creating a new category or editing an existing category, you will find that you can select the "document model" to which the category belongs.Once the category determines its associated model, all content under this category will follow the field structure of the model.

Next, when you add a document in the "Document Management" section of the backend, select the category you just created and associated with the custom model, you will find that the content editing interface, in addition to the traditional title, content, summary, etc., in the "Other Parameters" section, you will see all the fields you have customized for the model.Here, you can enter the corresponding data for each article.

Display custom content flexibly on the front end

The content model defines the structure and storage of data, and in order to elegantly present these structured data on the website front-end, it is necessary for us to flexibly use the template design function of Anqi CMS.AnQi CMS adopts syntax similar to Django template engine, making template creation both intuitive and powerful.

Template files are usually located/templatethe directory, and.htmlas a suffix. Anqi CMS will automatically match the corresponding template file according to the URL structure, for example{模型表名}/detail.htmlfor the detail page,{模型表名}/list.htmlUsed for list pages. Of course, you can also specify a custom template file path for specific content in the category or single page settings in the background, such as specifying for the "About Us" page.page/about.html.

To obtain data from your custom content model, the key is to use the template tags provided by Anqi CMS.

  1. Get standard field content:For fields built into the model, such as titles, content, links, etc., you can easily obtain them througharchiveDetailtags. For example, the title displayed on the real estate detail page is:<h1>{% archiveDetail with name="Title" %}</h1>Display the text:<div>{% archiveDetail with name="Content" %}{{archiveDetailContent|safe}}</div>Here|safeThe filter is very important, it ensures that the HTML content entered in the rich text editor can be normally parsed and displayed by the browser, rather than output as plain text.

  2. Get custom field content:This is the core of demonstrating the flexibility of a custom content model. Suppose you define a custom field named户型in the 'Real Estate' model, and its calling field name ishouseTypeYou can get and display it directly: `Room type: {% archiveDetail with name=“houseType” %}

Related articles

How to ensure that AnQiCMS multi-site content is independent and displayed correctly?

When operating multiple websites, we often face a core challenge: how to ensure that each site's content is independently operated and accurately displayed without confusion or misplacement.AnQiCMS (AnQiCMS) is a system designed for multi-site management and provides a well-considered solution in this regard, allowing us to comfortably expand different brands or business branches.**The foundation of building an independent site: from deployment to backend management** When we decide to build multiple sites with Anqi CMS, we start laying the foundation for content independence from the deployment phase.

2025-11-08

How to display the user submitted comment list on a website and support pagination?

Displaying user comments on the website and supporting pagination is an important aspect of enhancing content interactivity and user experience.AnQiCMS provides flexible template tags and data management features, allowing us to easily meet this requirement.Below, let's look at how to operate step by step. ### Comment feature: Make content more vibrant We all know that user comments are a reflection of the vitality of website content.They not only bring real user feedback to the website, but also effectively increase the freshness of the page and the attention of search engines.

2025-11-08

How to manage and display image resources, and categorize them in AnQiCMS?

## Secure CMS: The Art of Fine Management and Diversified Display of Image Resources In a content management system, images act as the soul of visual content, and the efficiency of their management and display directly affects the overall quality and user experience of the website.AnQi CMS understands this and provides users with a comprehensive and flexible image resource management solution, from upload and storage to intelligent processing, and to flexible display in various scenarios, striving to achieve the ultimate.### Centralized management of image resources

2025-11-08

How to display the website logo, filing number, and copyright information on the frontend page?

The website's logo, filing number, and copyright information are the three indispensable elements that constitute a professional and trustworthy online image.They not only help with brand recognition and promotion, but are also an important embodiment of compliance with laws and regulations and enhancing the credibility of the website.As a system specially designed for small and medium-sized enterprises and content operation teams, AnQiCMS (AnQiCMS) fully understands the importance of these details and provides an extremely convenient way to manage and display them.

2025-11-08

How to implement content switching and display on the page for AnQiCMS multilingual support?

In today's globalized internet environment, multilingual support for websites is no longer an optional feature, but a key factor for businesses to expand into international markets and improve user experience.For website operators who want to reach different language audiences, a CMS system that can flexibly manage and display multilingual content is particularly important.AnQiCMS (AnQiCMS) with its powerful functions, provides us with an efficient and convenient multi-language content switching and display solution.

2025-11-08

How can 301 redirects and static redirection optimize website URLs and ensure normal access and display of pages?

Optimize the website URL structure to ensure stable content presentation: The Practical Guide to Static and 301 Redirects of Anqi CMS In today's digital world, a website's URL (Uniform Resource Locator) is not just the address of a page, but also an important part of the website's content and brand image.A clear and meaningful URL structure not only allows visitors to easily understand the content of the page, but is also an important factor for search engines to judge page relevance and optimize rankings.SafeCMS deeply understands this, providing us with powerful static and 301 redirection functions

2025-11-08

How to ensure that the content imported in bulk is properly formatted and displayed on the front-end page?

Managing a large amount of content in Anqi CMS, especially through the batch import method, is undoubtedly a powerful tool to improve operational efficiency.However, while quickly filling in content, how to ensure that this content is presented in a neat, unified, beautiful, and practical manner on the website front-end page, and avoid chaotic or abnormal display, is a concern for many operators.This is not only dependent on the import function itself, but also requires us to plan meticulously before importing, operate carefully during the import, and optimize and correct effectively after the import.### Before import planning

2025-11-08

What is the impact of AnQiCMS anti-crawling function on the display of picture watermarks and content?

In today's internet age, where content is exploding, the value of original content is becoming increasingly prominent, but the issues of content theft and scraping that come with it also make many website operators headaches.AnQiCMS (AnQiCMS) fully understands this, and therefore integrates powerful anti-crawling and watermark management functions into the system design, aiming to effectively protect the original content and image copyrights of our website.How do these features specifically affect the display of picture watermarks and content on our website?Let us explore further. ### Image Watermark

2025-11-08