How to configure unique display fields for different content models in AnQiCMS to adapt to personalized content display?

Calendar 👁️ 64

In AnQi CMS, configuring unique display fields for different content models is a crucial function to meet the diverse display needs of website content.This capability allows us to flexibly customize the structure of articles, products, activities, or any other type of content based on specific business requirements, thereby providing a highly personalized content display experience.

Understand the content model: the foundation of personalized display

One of the core strengths of AnQiCMS is its 'flexible content model'.It allows us to break through the fixed limitations of traditional content management systems such as "articles" or "pages", and customize content types according to actual business scenarios.Imagine that your website not only needs to publish ordinary news articles, but also needs to display complex product details, activity registration pages, and even professional industry reports.Each content type has its unique properties, such as products need to have price, inventory, SKU;The event must have a start time, end time, and a maximum number of registrants;While news articles may require author, source, and other information.

The content model is a structured tool provided by AnQiCMS, which defines all the fields contained in a certain type of content.The system is pre-installed with the "Article Model" and "Product Model", but the real power lies in being able to create new models as needed, or modify existing models to equip them with unique field sets.

Configure unique display fields: the key to custom content models

The first step in displaying personalized content is to deeply customize your content model, adding exclusive display fields for it.

First, you need to enter the AnQiCMS management background, find "Content Management" in the left navigation menu, and then click "Content Model".This will list all existing content models, you can choose to edit an existing model, or click 'Add a custom model' to create a new content type.

Whether it is editing or adding, the core lies in the "Content Model Custom Field" area of the model detail page.Here, you can define any number of exclusive fields for the current model.Each custom field's settings are very intuitive:

  1. Parameter NameThis is the Chinese display name of the field, convenient for you to identify when publishing content in the background, such as 'Product Price', 'Event Location', etc.
  2. Field invocationThis is the unique identifier of the field, used for template calls and database storage. Please make sure to use letters, for exampleproductPrice/eventLocationThis name must be unique and consistent throughout the system.
  3. Field type: AnQiCMS provides various field types to meet different data format requirements:
    • Single-line text: Suitable for short text input, such as titles, contact names.
    • NumberEnsure the content is purely numeric, such as prices and quantities.
    • Multi-line textSuitable for long text descriptions, such as product introductions and event details.
    • Single choice: Provide preset options, the user can only select one item, such as "gender", "product color".
    • Multiple selectionsProvide preset options, the user can select multiple options, such as "Product Feature Tags".
    • Drop-down selectionSimilar to single choice, but presented in the form of a drop-down menu.When selecting a single, multiple, or dropdown option, you also need to enter each option on a new line in the "default value", and the system will automatically parse it into a list of selectable options.
  4. Mandatory?You can decide whether the field is required to be filled in when publishing content based on the importance of the content.
  5. Default valueSet a default value for the field. This is where you define the option list for select fields.

After completing the field configuration, save the model. When you enter the "Content Management" "Publish Document" page, select the category associated with your customized model, and you will find that these newly defined fields are clearly presented in the "Other Parameters" section, waiting for you to fill in specific data for each piece of content.

Display custom fields in the frontend template: transform data into visual elements.

It is not enough to configure fields and data in the background to achieve personalized display; the key is how to extract and present these custom field data in the website's front-end template.AnQiCMS's template engine supports Django-like syntax, making data calls very flexible and powerful.

How many common methods are there to display custom fields in a template:

  1. Directly call a specific custom field If you know the name of the "callback field" of the custom field, you can use it directly.archiveDetailLabel to retrieve and display its value. For example, if your product model has a custom field namedproductPriceYou can call it like this in the product detail page template:

    <div>产品价格:{% archiveDetail with name="productPrice" %}</div>
    

    For custom fields of multi-image upload type, for examplearcimagesyou may need to display in a loop:

    {% archiveDetail arcimages with name="arcimages" %}
    <ul class="product-gallery">
      {% for img in arcimages %}
      <li><img src="{{img}}" alt="产品图片" /></li>
      {% endfor %}
    </ul>
    
  2. Loop through all custom fieldsIn some cases, you may want to dynamically list all custom fields and their values without needing to know their names. At this point,archiveParamsTags are very useful. It will return an array containing all custom fields, you can iterate through the array to display:

    {% archiveParams params %}
    <div class="product-specs">
        {% for item in params %}
        <div>
            <span>{{item.Name}}:</span> <!-- 显示字段的中文名称 -->
            <span>{{item.Value}}</span> <!-- 显示字段的值 -->
        </div>
        {% endfor %}
    </div>
    

    If you want to exclude some custom fields that are not needed for frontend display, you can add conditional judgments in the loop, for example:

    {% archiveParams params %}
    <div class="product-specs">
        {% for item in params %}
        {% if item.Name != '内部备注' and item.Name != '管理代码' %}
        <div>
            <span>{{item.Name}}:</span>
            <span>{{item.Value}}</span>
        </div>
        {% endif %}
        {% endfor %}
    </div>
    
  3. Combine the filtering function to achieve advanced display: In addition to being displayed on the detail page, you can also use custom fields to implement complex filtering functions on the list page. AnQiCMS'sarchiveFiltersTags allow you to create dynamic filter conditions based on custom fields defined in the model.For example, on a real estate information website, you can use custom fields such as 'house type', 'area', 'price range', etc. to help users locate the listings they are interested in.After the user selects the filter condition,archiveListTags will automatically search based on these conditions and display matching content, greatly enhancing the interactivity and user experience of the website.

**Practice and Precautions

  • Naming conventionSelect a concise and meaningful English name for the 'invoked field', which is convenient for template developers to understand and call.
  • Field type matchAccording to the actual data content, choose the most suitable field type, for example, selecting the 'number' type for price can avoid input errors and facilitate subsequent numerical calculations.
  • Plan firstBefore creating a content model and custom fields, it is best to plan all the content properties you want to display to avoid frequent modifications later.
  • Test verification:After completing the configuration and call of custom fields and templates, be sure to carry out comprehensive testing on different pages and scenarios to ensure that the content is displayed correctly and beautifully.
  • Focus on SEOAlthough custom fields are mainly used for content display, their content itself will also be crawled by search engines.Ensure that the text content in the custom field is valuable and helps improve page relevance.

By using AnQiCMS's flexible content model and custom field features, you can easily achieve highly personalized content management and display.Whether it is to build a functional e-commerce platform or operate a content-rich media website, these tools will help you a lot, making your website content more attractive and more in line with user needs.


Frequently Asked Questions (FAQ)

**1. Why am I unable to publish an article after adding custom fields in the content model?

Related articles

What methods does AnQiCMS support to accurately control the display of keywords and descriptions of website content in search results?

In today's highly competitive online environment, making website content stand out in search engines is a focus for every operator.Precisely controlling the keywords and descriptions of website content is a key strategy to improve search visibility, attract target users, and optimize click-through rates.AnQiCMS as an enterprise-level content management system provides multi-dimensional, in-depth functional support, allowing you to flexibly and meticulously manage the SEO performance of your website.

2025-11-09

How to customize the title display format of AnQiCMS article detail page to meet SEO requirements?

In website operation, the title of the article detail page (`<title>` tag) is crucial for search engine optimization (SEO).A well-designed title can not only improve the click-through rate of the article in the search results, but also help search engines better understand the content of the page.AnQiCMS provides a flexible mechanism that allows you to easily customize the title display format of the article detail page according to your own SEO strategy.This article will introduce how to adjust the title of the article detail page in AnQiCMS to meet different SEO requirements.

2025-11-09

Does the `urlize` filter apply to processing URLs in a large amount of user-generated content (UGC)?

## The `urlize` filter of AnqiCMS: An intelligent assistant for URL processing in UGC content and operational considerations In the current era where content is king, user-generated content (UGC) has become an indispensable part of the website.From comments, forum posts to user submissions, the vast amount of UGC greatly enriches the website ecosystem.However, the problem that follows is the handling of URLs in the content.

2025-11-09

Can you disable the `urlize` filter from automatically adding `rel="nofollow"`?

When using Anqi CMS for content creation, the `urlize` filter is undoubtedly a very convenient feature.It can intelligently recognize URLs or email addresses in article content, automatically converting them into clickable hyperlinks, saving the麻烦 of manually adding links.However, careful friends may notice that these links automatically generated by `urlize` will default to having the `rel="nofollow"` attribute.

2025-11-09

How to implement multi-language content switching and display for AnQiCMS to serve global users?

Under the wave of global digitalization, your website can communicate seamlessly with users worldwide in multiple languages, which is no longer a luxury but a key step to expanding the international market and enhancing brand influence.AnQiCMS (AnQi CMS) was born to meet such needs, it provides a flexible and efficient solution that makes the switching and display of multilingual content simple and powerful. ### How to build a multilingual content system in AnQiCMS?

2025-11-09

How to use the pseudo-static feature of AnQiCMS to optimize the URL structure to improve the crawling and display effect of search engines?

## Utilizing AnQiCMS's SEO-friendly URL structure: A practical guide to improving search engine crawling and display effectiveness in the digital marketing wave In today's digital marketing wave, Search Engine Optimization (SEO) has become one of the key factors for website success.A clear, friendly, and semantically rich URL structure is undoubtedly the cornerstone of improving a website's SEO performance.It not only helps search engines crawl and understand your content more efficiently, but also significantly improves the reading experience and memorability of users.

2025-11-09

How to call and display the thumbnail or cover image of AnQiCMS template, what processing methods are supported?

In website content operation, images play a vital role. They can attract users' attention, enhance the beauty of the page, and are an indispensable part of search engine optimization (SEO).AnQiCMS provides flexible and diverse mechanisms to handle and display thumbnails or cover images for articles, categories, single pages, etc. Whether it is automated processing in the background or fine control at the template level, it can meet all kinds of content operation needs.

2025-11-09

How to configure the pagination display style of the content list in AnQiCMS to improve user experience?

In AnQiCMS, optimizing the pagination display of the content list is crucial for improving the user browsing experience.A well-designed, easy-to-use pagination system not only helps visitors efficiently find information but also improves the website's SEO performance.AnQiCMS provides intuitive and powerful template tags, allowing us to easily achieve these goals.

2025-11-09