How to dynamically display all custom fields under the current content model in the template, including their `parameter name` and `field call`?

Calendar 👁️ 68

In the powerful feature matrix of AnQi CMS, the content model and custom fields are undoubtedly one of its core highlights.It provides the website with great flexibility, allowing operators to build various types of content structures such as articles, products, services, and cases according to actual business needs.However, for operators who are not familiar with template development, it is often a challenge to dynamically and elegantly display these rich and diverse custom fields on the website front-end, especially when it comes to showing both their 'parameter names' and 'actual values'.

Today, as an experienced website operations expert, I will guide you to deeply analyze the method of dynamically displaying all custom fields under the current content model in Anqi CMS template, helping you to perfectly present the flexible configuration of the backend to the users.

Understanding the content model and customized fields of AnQi CMS

First, let's briefly review the concept of custom fields in AnQi CMS.In AnQi CMS backend, you can enter the 'Content Management' under the 'Content Model' feature.Here, you can create or edit different content models (such as 'article model', 'product model').Each content model can add a series of "custom content model fields".

When you add a custom field, you need to define several key pieces of information:

  • Parameter Name (Name):This is used in the backend management interface and frontend template.DisplayGive to the user or as a label name, for example 'Article Source', 'Product Model'.
  • Field Name (FieldName):This is stored in the database and displayed in the front-end templateTechnical callThe unique identifier of this field, usually a combination of lowercase English letters, such assource/model_number.
  • Field type:Determines the form of the input data for the field, such as single-line text, multi-line text, number, radio, checkbox, etc.
  • Whether mandatory, default value, etc.:Further standardize the behavior of the field.

The value of dynamically displaying these fields is that, regardless of how many custom fields you add to the content model or how you modify them in the future, the template can intelligently traverse and display them without needing to modify the template code each time.

The core idea of dynamically obtaining custom fields in the template

The AnQi CMS template engine (similar to Django or Blade syntax) provides powerful tags for retrieving and processing data.For the need to dynamically display custom fields, we no longer need to hard code the 'call field' names for each field one by one.The core idea is to use a special tag that can return a list of all custom fields under the current content (such as articles, products), and then we traverse the list to extract the 'parameter name' and 'actual value' of each field.

Here, our main character isarchiveParams.

UsearchiveParamsTraversal of custom fields by tag

archiveParamsThe tag is designed to obtain custom parameters for the current document (or specified document).It can provide all the custom fields configured for the document in a traversable array object to the template.

archiveParamsBasic usage of tags

Usually, you will be in the document detail page (for example{模型table}/detail.htmlThis tag is used in the structure. Its basic format is as follows:

"twig {% archiveParams params with sorted=true %}"

{% for item in params %}
    <div>
        <span>{{ item.Name }}:</span>
        <span>{{ item.Value }}</span>
    </div>
{% end

Related articles

Can I configure different publishing processes or review mechanisms for different content models? Will this affect the use of the `moduleDetail` tag?

As an experienced website operations expert, I am more than happy to delve deeply into the powerful capabilities of Anqi CMS in content model configuration and publishing process.AnQi CMS, with its efficient architecture in Go language and excellent customizability, indeed provides us with great flexibility in content operations, especially when dealing with different types of content, it can provide differentiated management strategies.Let's dive straight into the core issue: **Can AnQi CMS configure different publishing processes or review mechanisms for different content models?Does this affect the usage of the `moduleDetail` tag?

2025-11-07

What are some internal identifier fields of the content model that can be called by the `moduleDetail` tag, besides `Title` and `Name`?

In the vast realm of AnQi CMS, the content model is undoubtedly one of its core charms, giving us the ability to flexibly define content structures according to business needs.When you use the `moduleDetail` tag in the template to call model data, you may have become accustomed to obtaining basic information through `Title` (model title) and `Name` (model name).But as a senior website operator, we know that efficient content operation often requires deeper data support.

2025-11-07

How to ensure that the `siteId` parameter in the `moduleDetail` tag correctly calls data in a multi-site environment and avoids cross-contamination?

## Deep Analysis and Practice of Data Isolation under the Multi-site Architecture of AnQi CMS: `moduleDetail` Tag and `siteId` ParameterAnQiCMS (AnQiCMS) is a corporate-level content management system tailored for such needs, which provides users with powerful multi-site management capabilities with its efficient and flexible Go language architecture.

2025-11-07

Does AnQi CMS content model support inheritance or parent-child relationships to simplify the management of complex content structures?

As an experienced website operation expert, I have a deep understanding of the various functions and content operation strategies of AnQiCMS (AnQiCMS), and I am often asked how to more efficiently manage the complex content structure of the website.One of the core issues is whether the Anqi CMS content model supports inheritance or parent-child relationships to simplify the management of complex content structures?Today, let's delve deeply into this issue. ### Unique Design Concept of Anqi CMS Content Model Anqi CMS, this enterprise-level content management system developed based on Go language, is designed in the content model on

2025-11-07

`moduleDetail` tag fetches the model introduction (`Description`) does it support HTML content?How to safely render in the template?

As an experienced website operation expert, I fully understand the specific problems you may encounter in AnQiCMS template development and content operation.Flexible content display is the core advantage of CMS, but the content security and correct rendering that come with it also need our careful consideration.Today, let's delve deeply into whether the `moduleDetail` tag supports HTML content in the model description (`Description`) and how to safely render it in the template.### Unveiling AnQiCMS

2025-11-07

What are the advantages of the "Flexible Content Model" project of AnQi CMS, and how is customization manifested on the front end through tags like `moduleDetail`??

## AnQi CMS: How to create a versatile front-end experience through `moduleDetail` and other tags As an experienced website operations expert, I know that the core value of a content management system (CMS) lies in its flexibility and adaptability.In today's rapidly changing digital marketing environment, a rigid, difficult-to-customize system undoubtedly becomes a fetter to corporate development.AnQiCMS (AnQiCMS) delivered a satisfactory answer to this challenge with its high-performance architecture based on the Go language

2025-11-07

How to use AnQiCMS navigation list tags to display two-level or multi-level menu structures?

The operation of a website is like steering a ship, and a clear navigation system is like a compass guiding the direction.In the world of content management, a high-efficiency, flexible navigation menu can not only greatly enhance the user experience, allowing visitors to navigate your website freely, but is also an important foundation for optimizing website structure and improving search engine friendliness.AnQiCMS (AnQiCMS) fully understands its way, providing users with a powerful and intuitive navigation list tag, making it easy to build a multi-level menu structure.Today, let's delve into how to skillfully use the `navList` tag in AnQiCMS

2025-11-07

How to determine the currently active (active) navigation item in the AnQiCMS navigation list?

As an experienced website operation expert, I fully understand the importance of navigation menus for user experience and website structure.An active navigation item that can clearly indicate the current position, not only can it improve the user's browsing efficiency, but also provide positive visual feedback.In such an efficient and user-friendly content management system as AnQiCMS (安企CMS), the realization of this feature is equally concise and powerful.Today, let's delve into how to cleverly judge and mark the currently active navigation item in the AnQiCMS navigation list, making your website navigation smarter and smoother

2025-11-07