How to customize the content model to flexibly display articles, products, events, and other types of information?

Calendar 👁️ 72

In today's increasingly diversified era of content marketing, the types of information that websites need to carry are also becoming richer.Relying solely on the general types of "articles" and "products" often fails to meet the personalized display needs of enterprises or self-media operators, such as posting event notifications, job openings, case studies, or industry reports.At this time, the customized content model feature provided by AnQiCMS (AnQiCMS) has become a powerful tool for us to flexibly manage and display this diversified information.

Content model, as the name implies, is a structural blueprint for content.It defines which fields a certain type of information contains, the type of each field, and how to organize these pieces of information.AnQi CMS knows the importance of this flexibility for content operation and therefore integrated a highly customizable content model mechanism from the beginning of system design.This is like providing you with a set of Lego blocks, where you can build various shapes of content containers according to your own creativity and business logic, allowing your website to break free from traditional content frameworks.

Set up a dedicated content structure: The mysteries of custom content models

In AnQi CMS, the process of customizing content models is intuitive and logical.You can find the 'Content Model' feature entry through the 'Content Management' module on the back end.The system is default built-in with 'Article Model' and 'Product Model' as two basic models, which can be used as a quick start point and also can be modified according to requirements.However, the true power lies in creating a completely new model that fits your business logic.

Assuming you need to publish a series of offline event information, the traditional "article" model may only have a title and content, which cannot clearly show the event time, location, number of participants, and other key information.At this time, it is particularly necessary to customize an 'activity model'.

When creating a new model, you need to set the following core properties:

  • Model name:This is the Chinese name that users see in the background, such as "Activity Information", "Job Positions". It should clearly describe the content type carried by the model.
  • Model table name:This is the table name used by the system to store the model data in the database.For the stability and standardization of the system, it must use English lowercase letters.For example, if you create a "event information" model, the table name can be set toactivity.
  • URL alias:Used to generate friendly URL addresses, usually in lowercase English letters, such asevent. This is crucial for SEO optimization and user experience.
  • Title Name:This is the prompt text for the main title of the content when publishing the model.For example, in the 'event model', you can set it to 'event topic' to make it clear to the content editor.

The core charm lies in the flexible configuration of custom fields

After completing the basic model settings, the next step is to customize the field, which is the core of the content model truly demonstrating its flexibility.You can add unique fields for each model to accurately capture and manage the specific attributes of this type of content.

Continue with the example of 'activity model', you can add the following fields to complete the activity information:

  • Parameter name:This is the display name of the field, such as 'Event Date', 'Event Location', 'Registration Deadline', 'Event Manager'.
  • Call field:this is the english identifier used when calling this field in the template, it is also recommended to use lowercase letters, for exampleevent_date/location/deadline/organizer.
  • Field type:Our company provides various field types for different data storage needs:
    • Single-line text:Suitable for short text information, such as "Event location".
    • Number:Applicable to pure numeric information, such as "Maximum number of participants."
    • Multi-line text:Applicable to longer descriptive text, such as "Event details."
    • Single choice, multiple choice, dropdown choice:A choice suitable for preset options, such as "activity type" (lecture, exhibition, salon), or "participant" (students, staff, everyone).You can enter options one per line in the default value.
  • Mandatory?:Set whether this field must be filled in.
  • Default:Set an initial value for the field to improve the efficiency of content publishing.

In this way, you not only create a dedicated data structure for "event information", ensuring that each event information is complete and standardized, but also greatly improve the efficiency of content management.Similarly, for the "Job Posting" model, you can set fields such as "Location", "Salary Range", "Education Requirements", and so on;For the "case study", you can set fields such as "client name", "industry field", "solve problems", etc.

Integration of content with the model: collaboration between categories and documents

In Anqi CMS, the content model has a close hierarchical relationship with categories and documents.Each category must belong to a specific content model, and each document you publish must first select a category and then inherit all the fields of the category model.

This means that when you create or edit a category under "Content Management", you need to associate it with the previously defined "activity model".After you publish a new document under this category, the system will automatically present all the custom fields in the "event model", allowing you to fill in complete event information according to the preset structure.This design ensures consistency in content structure, avoiding information omission or confusion.

Display custom content flexibly in the front-end template.

The ultimate purpose of content model customization is to display this information in a clear and beautiful way on the website front-end.The Anqi CMS based on the Django template engine syntax provides rich template tags, allowing you to easily display data from the model on the page.

When displaying a single content detail page,archiveDetailtags are your main tool. Through{{archive.你的调用字段名}}Or{% archiveDetail with name="你的调用字段名" %}you can directly call the value of a custom field. For example, to display 'event date', you can use{{archive.event_date}}.

If you want to display different types of custom content in a list form,archiveListtags will shine. You can use parameters to specify which document list of the content model you want to get, and combinemoduleIdthe parameters to combine the document lists of different content models.archiveParamsLabel, dynamically retrieve and display each content's custom field in a loop.

For example, you can call it like this on an event list page.

{% archiveList activities with moduleId="活动模型ID" type="page" limit="10" %}
    {% for activity in activities %}
    <div>
        <h3><a href="{{activity.Link}}">{{activity.Title}}</a></h3>
        {# 直接调用自定义字段,假设调用字段是 event_date, location #}
        <p>活动日期:{% archiveDetail with name="event_date" id=activity.Id %}</p>
        <p>活动地点:{% archiveDetail with name="location" id=activity.Id %}</p>
        <div>{{activity.Description}}</div>
    </div>
    {% endfor %}
{% endarchiveList %}

If the model has many custom fields, or you want to handle these fields more universally,archiveParamsThe tag can return all custom fields in an array format, making it convenient for you to iterate and display:

{% archiveList activities with moduleId="活动模型ID" type="page" limit="10" %}
    {% for activity in activities %}
    <div>
        <h3><a href="{{activity.Link}}">{{activity.Title}}</a></h3>
        {% archiveParams params with id=activity.Id %}
        {% for item in params %}
        <div>
            <span>{{item.Name}}:</span>
            <span>{{item.Value}}</span>
        </div>
        {% endfor %}
        {% endarchiveParams %}
        <div>{{activity.Description}}</div>
    </div>
    {% endfor %}
{% endarchiveList %}

In addition, if you want users

Related articles

How to efficiently manage and display independent content and data for multiple sites in AnQiCMS?

Managing the content and data of multiple websites is often a time-consuming and error-prone challenge for many businesses and content operators.Different brands, product lines, or independent sites for different regions or language audiences often mean that separate content management systems need to be independently built and maintained, leading to分散 of resources, increased workload, and even making it difficult to achieve effective collaboration management.

2025-11-07

How to display independent content and configuration for each site in a Docker-deployed AnQiCMS multi-site environment?

In today's internet operations, many companies or individuals often need to manage multiple websites to serve different brands, products, or target audiences.AnQiCMS (AnQiCMS) leverages its powerful multi-site management capabilities to easily meet this requirement on a single core system.When combined with Docker, a popular containerization technology, how to ensure that each site can run efficiently and independently display its content and configuration has become a topic worth discussing.

2025-11-07

How to display a friendly prompt page to users during website maintenance or upgrade?

During the operation of the website, whether it is system upgrades, data migration, or routine maintenance, it is inevitable that there will be situations where the website needs to be temporarily closed or some functions cannot be accessed.How to convey clear and friendly information to users visiting the website at this time, to avoid confusion or direct loss of users, is the key to improving user experience and maintaining brand image.lucky enough, AnQiCMS provides a simple and efficient mechanism to help us easily deal with such situations. ### Why is it necessary to have a friendly maintenance page for website upgrades?

2025-11-07

How to organize reusable display modules in a template through `include`, `extends`, and other tags?

Aq enterprise CMS template: Use `include` and `extends` to create efficient and reusable display modules When using Aq enterprise CMS to build a website, you will quickly find that it is very flexible in organizing content display.Especially when dealing with templates, the built-in Django template engine syntax allows us to build pages efficiently like building with blocks.Today, let's talk about how to cleverly use the powerful tags `include` and `extends` to organize and manage reusable display modules on your website, making your templates cleaner and easier to maintain

2025-11-07

How does AnQiCMS's multilingual support feature help website content to be targeted at global users?

In the digital age, website content is no longer just for local users, but carries the mission of connecting with a global audience.For businesses and content operators that want to expand into the international market and serve users with diverse cultures, embracing multilingual capabilities has become the key to success.AnQiCMS, as an efficient content management system, is well-versed in this and provides a solid foundation for your website content to go global through its powerful multilingual support feature.AnQiCMS was designed with globalization needs in mind, one of its core features is to provide native support for switching and displaying multilingual content

2025-11-07

How to configure pseudo-static and 301 redirection to optimize website URL structure and SEO effects?

The structure of a website's URL is like the address of a building, a clear and logical address not only allows visitors to easily find their destination, but also helps "mailmen" (search engine spiders) to efficiently deliver "parcels" (website content).A well-designed URL structure is the foundation for improving search engine optimization (SEO) effectiveness.AnQiCMS knows this and therefore integrated powerful pseudo-static and 301 redirect management features into its design, aimed at helping users easily build SEO-friendly websites.Understanding the importance of pseudo-static URLs In the world of websites

2025-11-07

How do AnQiCMS's advanced SEO tools (such as Sitemap, keyword library) specifically improve the search engine ranking of a website?

### How AnQiCMS's advanced SEO tools can help your website stand out in search engines?In today's highly competitive online environment, it is crucial to have a good search engine optimization (SEO) strategy to make your website stand out among the vast amount of search results.This often causes many website operators to feel headaches, because SEO involves many technical details and is complex.However, through a professional content management system like AnQiCMS, even complex SEO work can be efficient and intuitive.AnQiCMS provides a series of powerful advanced SEO tools

2025-11-07

In which operation scenarios can the full-site content replacement feature significantly improve work efficiency?

## AnQi CMS Full Site Content Replacement: An Operation Tool to Improve Work Efficiency In daily website operations, we often encounter situations where we need to modify a large amount of content, whether it is adjusting brand information, updating SEO strategies, or dealing with outdated content.Manually search and edit one by one, not only time-consuming and labor-intensive, but also prone to errors. 幸运的是,AnQiCMS提供的全站内容替换功能,恰恰是解决这些痛点的“秘密武器”,它能显著提高我们的工作效率,让我们有更多精力专注于更有价值的运营策略。

2025-11-07