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

Calendar 👁️ 61

In the field of content management, website operators often face a variety of content display needs.From traditional article publishing, news updates, to complex e-commerce product details, event registration pages, and even team member introductions or customer case displays, each type of content has its unique structure and field requirements.If relying solely on a single content format, it is not only difficult to manage efficiently, but it will also limit the flexibility and user experience of the website.AnQi CMS understands this diversity and therefore provides a highly flexible content model customization feature, aimed at helping users easily manage various types of content and build a dedicated and efficient content display system.

Content model: The foundation for building diversified content

In AnQi CMS, the content model can be understood as the 'blueprint' or 'skeleton' of the content.It defines what data fields and properties a certain type of content should include.For example, an "article" model may contain fields such as title, author, publication date, content, and so on;And a "product" model may require product name, price, inventory, image set, detailed description, and so on.The Anqi CMS system provides the 'Article Model' and 'Product Model' by default, as the most commonly used content type basis.

But the content requirements in reality are not limited to this. Imagine that if your website needs to display a series of complex electronic products, each product has its own parameters such as processor model, memory size, screen size, and so on;Or you are running an event publishing platform, and you need to add start time, end time, location, and registration link information for each event.If only simple fixed models are used, it is difficult to manage these specific information structurally, let alone display and retrieve it efficiently.At this point, a customized content model is particularly crucial, as it allows the system to greatly enhance its adaptability and meet various personalized content publishing needs.

How to customize the content model

The process of customizing the content model of AnQi CMS is intuitive and powerful.You can find the "Content Model" feature under the "Content Management" menu in the background.Here, you can choose to modify an existing model, such as adding more dedicated fields to the 'Product Model', or you can create a completely new custom model to meet your unique business needs.

When creating or modifying a content model, there are several core elements that need to be defined:

  1. Model name: This is the Chinese display name of the model on the back-end and front-end, convenient for identification and management. For example, 'Event Details', 'Talent Recruitment'.
  2. Model table nameThis is the table name stored in the database for model data, it must beEnglish lowercase letters.
  3. URL aliasThis is used to generate friendly URL paths, it is also recommended to useEnglish lowercase lettersFor example, it is used in pseudo-static rules.{module}When called, this alias will come into play.
  4. Title Name: Define the prompt text for the title field when publishing content, for example, in a product model, you can set it to "Product Name".

In addition to these basic settings, the most powerful feature of the content model is itsCustom fieldFunction. By adding custom fields, you can inject personalized data structures for different types of content.The Anqi CMS supports various field types and can cover the vast majority of content management needs:

  • Single-line text: Suitable for short text information, such as article authors, product brands, event locations, and so on.
  • Number: Designed specifically for numerical data, such as product prices, inventory quantities, property areas, etc., to ensure the accuracy of data formats.
  • Multi-line text: Suitable for long descriptive content, such as product details, event agenda, personal introduction, etc.
  • Single choice: Provide preset options, the user can only select one, such as product color, service type, free shipping, etc.
  • Multiple selections: Similar to a single selection, but allows users to choose multiple preset options, such as product sizes (S, M, L, XL), etc.
  • Drop-down selection: Provide preset options in the form of a dropdown menu, from which the user can select an item, commonly used for regions, industry classifications, etc.

When defining these custom fields, you can also set whether they arerequiredProvide for single-choice, multiple-choice, and dropdown field typesDefault valueEnsure the completeness and standardization of the content. For example, set options such as 'red, blue, black' for the 'product color' field, and the publisher can simply check the box.

Display custom content on the front end

After customizing the content model and adding rich fields, the next step is to present these data on the website's frontend page.The AnQi CMS template engine provides intuitive and flexible tags, allowing you to easily call and display these custom data in templates.

  1. Display custom fields on the detail pageWhen you need to display the details of a single content (such as an article or a product page), you can usearchiveDetailLabel directly calls a custom field. For example, if you add a single-line text field namedauthorto the article model, you can call it like this in the article detail template:<div>作者:{% archiveDetail with name="author" %}</div>Or if you have customized a field namedproduct_specsto record product specifications in multi-line text, it can be displayed as follows:<div>产品规格:{% archiveDetail with name="product_specs" %}</div>For rich text custom fields containing HTML, such as 'Product Description', in order to ensure that the content is parsed and displayed correctly, you need to use|safeFilter, and if the content is written in Markdown, it can also be added withrender=trueparameters to render into HTML:<div>{% archiveDetail productContent with name="product_long_description" render=true %}{{productContent|safe}}</div>

  2. Loop to display all custom fieldsSometimes, you may want to display all custom fields of a certain content in a list, especially when there are many product parameters or event information.archiveParamsTags are born for this. It will return an array of custom fields, which you can iterate through to display each field name and value:

    {% archiveParams params %}
    <div>
        {% for item in params %}
        <div>
            <span>{{item.Name}}:</span>
            <span>{{item.Value}}</span>
        </div>
        {% endfor %}
    </div>
    {% endarchiveParams %}
    
  3. Custom fields for categories or single pages: In addition to the content detail page, you may also add custom fields for categories or single pages, such as adding a "Category Banner Image" field for the "Product Category". At this point, you can usecategoryDetailorpageDetailLabel to call these fields. For example, get the custom Banner image for categories:<div><img src="{% categoryDetail with name="category_banner_image" %}" alt="分类Banner" /></div>

  4. Filter and display in the content list.Further, the data of the customized content model can be used to build complex content lists

Related articles

How does AnQi CMS ensure that website content is presented efficiently and elegantly to users?

## AnQi CMS: The smart choice for efficient and elegant display of website content In today's digital age, a website is not just a carrier of information, but also a window of brand image and a stage for user experience.To ensure that the content of the website can reach the target audience quickly and presented in an engaging way, efficient management and elegant presentation are indispensable.

2025-11-07

How to use the `add` filter for numeric addition or string concatenation in AnQi CMS template?

In daily website content display and function development, we often need to perform some simple data processing, such as adding numbers or concatenating several text segments.AnQi CMS is well aware of these needs and provides very practical template filters to simplify these operations.Today, let's delve deeper into one of the especially convenient tools - the `add` filter.### Get to know the `add` filter: A tool for adding numbers and concatenating strings Imagine that you need to add two numbers in a template or need to merge the title and subtitle of an article display

2025-11-07

How does the string case conversion filter of Anqi CMS affect strings containing Chinese or other non-English characters?

In the daily content operation of AnQi CMS, we often need to process strings in various ways, among which case conversion is one of the common requirements.AnQi CMS is developed based on Go language, its template engine supports rich filter functions, which can easily realize these operations.However, when dealing with strings containing Chinese or other non-English characters, the behavior of these case conversion filters may differ from that of handling English characters. Understanding this is very important for ensuring the correct display of content.

2025-11-07

I want to capitalize the first letter of each word in the article title, can the `title` filter of Anqi CMS template achieve this?

In website operation, we often need to format content in detail to enhance user experience and page aesthetics.Especially when dealing with article titles, if each word can be automatically capitalized, it will undoubtedly make the title look more standardized and professional.So, as a user of AnQiCMS, can we meet this need through its powerful template function?

2025-11-07

How does the Anqi CMS implement seamless switching and display of website content with multilingual functionality?

In the wave of globalization, multilingual support for websites is no longer just a cherry on top, but the foundation for reaching a wider user base.For enterprises that wish to expand into the international market and serve a diverse multicultural audience, a CMS that can efficiently manage and display multilingual content is particularly important.AnQiCMS (AnQiCMS) provides very practical functions in this aspect, helping us achieve seamless switching and display of website content.

2025-11-07

How does the static URL structure affect the display and user experience of my content in search engines?

In website operation, we often encounter such situations: the same content, but the access address looks quite different.Some URLs are long and contain complex question marks and equals signs, such as `www.example.com/article.php?id=123&cat=tech; whereas some are concise and clear, like `www.example.com/tech/my-great-article.html`.

2025-11-07

How to use the SEO tools of Anqi CMS to improve the visibility of content in search results?

In today's highly competitive online environment, the visibility of a website in search engines is directly related to its ability to attract visitors and achieve business goals.As a powerful content management system, AnQiCMS (AnQiCMS) fully understands this and has built a series of efficient SEO tools for this purpose.These tools are designed to help you optimize your website content, making it easier for search engines to discover and rank, thereby significantly increasing its visibility in search results.

2025-11-07

How to customize the display layout of the article detail page in AnQiCMS?

When using AnQiCMS to manage website content, the layout and display effects of the article detail page directly affect the user experience.AnQiCMS provides high flexibility, allowing us to customize the display layout of the detail page according to the needs of different types of content or specific articles, without being limited to a single template style.To implement the personalized layout of the article detail page, we mainly use the template mechanism and content management function of AnQiCMS.The core idea is: define various layout structures in the template file, and then select the corresponding layout when editing articles in the background.

2025-11-07