How to configure custom parameters in the background of AnQiCMS and flexibly call and display them in the front-end template?

Calendar 👁️ 90

In website operation, we often encounter the need to add some personalized information to the content or the global website outside of the standard fields.This information may include the distinctive features of a website, product parameters, specific attributes of articles, and even multi-channel contact information, etc.AnQiCMS (AnQiCMS) understands the importance of this flexibility, therefore it provides a powerful custom parameter configuration function, allowing you to easily define the required data in the background and flexibly call and display it in the front-end template.

Next, we will delve into how to configure these custom parameters in the Anqi CMS backend, as well as how to巧妙ly apply them in your website front-end template.

The first part: Configure custom parameters in the Anqi CMS backend

The configuration of Anqi CMS custom parameters is mainly divided into two categories: custom parameters for global website settings and contact information, as well as custom fields for different content models (such as articles, products).

1. Configure global and contact information customization parameters

The global information and contact details of a website often need to be adjusted according to business changes, and it is obviously not an efficient solution to modify the template code each time.The AnQi CMS allows you to directly add these general custom parameters in the background.

Operation path:Log in to the Anqi CMS backend, you can find "Backend Settings" in the left menu.

  • Global settings:Enter the "Global Function Settings" page, scroll to the bottom to see the "Custom Setting Parameters" area.
  • Contact Information:Enter the "Contact Information Settings" page, and there is also a "Custom Setting Parameters" area at the bottom.

Configuration method:Click the "Add Parameter" button, and you will see three input boxes:

  • Parameter name:This is the unique identifier you use when calling the template.Suggest using English or pinyin, such as “HelpUrl”, “WhatsApp”.The system will automatically convert it to camel case.
  • Parameter value:The actual content of this parameter, such as a help page URL or your WhatsApp account.
  • Note:Used to describe the purpose of this parameter, convenient for future management and understanding.

In this way, you can easily add global information such as company honors, special service links, language switch prompts for multilingual websites, or more social media contact information other than phone and email.

2. Configure custom fields of content models

For different types of content such as articles, products, and activities, the information structure they need to display is often quite different.For example, a product introduction may require attributes such as 'color', 'size', 'material', etc., while a news article may require 'author', 'source', 'reading time', etc.The AnQi CMS content model custom field function is specifically designed to meet such needs.

Operation path:In Anqi CMS backend, select the "Content Management" menu, then click the "Content Model".Here is listed all the content models on your website, such as the default "article model" and "product model".

Configuration method:

  1. Edit or add models:You can choose to edit an existing model, or click 'Add Model' to create a new content type.
  2. Add custom field:Enter the model editing page, find the "Content Model Custom Field" area. Click the "Add Field" button, and a field configuration interface will pop up:
    • Parameter name:This is the Chinese name of the field that the background editor sees when publishing or modifying content, such as 'Article Source', 'Product Color'.
    • Call field:This is the unique English identifier used to retrieve the value of this field in the front-end template.Ensure the name is concise and descriptive, for example, "source", "color".This field name will be stored directly as a database field.
    • Field type:AnQi CMS provides various field types to adapt to different data formats:
      • Single-line text:Suitable for short text input, such as author names, article sources.
      • Number:Only allows input of numbers, such as prices, inventory.
      • Multi-line text:Text suitable for long content, such as a brief introduction of product details.
      • Single choice/Multiple choice/Dropdown choice:These types are suitable for scenarios where preset options need to be chosen, such as product colors (red, blue, black), and house types (residential, commercial).
    • Mandatory?:Determine whether this field is required based on business needs.
    • Default:Set an initial value for the field. For selection types, this is used to define all possible options, with one option per line.

After completing the configuration of custom fields, when you add or edit documents under the corresponding model in "Content Management

The second part: Flexible display calls in the front-end template

After configuring the background parameters, the next step is to display this data to the visitor in the front-end template.The Anqi CMS template engine syntax is similar to Django, data calls can be realized through concise tags.

1. Call the custom parameters of global and contact information

For custom parameters added in the "Global Function Settings" and "Contact Information Settings", Anqi CMS provides specific tags for calling:

  • Global custom parameters:Use{% system %}Label. If you add a parameter named "HelpUrl" (help page link) in the background global settings, its value ishttps://www.yourdomain.com/helpyou can call it like this in the template:

    <a href="{% system with name="HelpUrl" %}">访问帮助中心</a>
    
  • Custom contact information parameters:Use{% contact %}Label. If you add a parameter named "WhatsApp" (WhatsApp account) in the background contact settings, its value is+1234567890How to call:

    <span>我们的WhatsApp:{% contact with name="WhatsApp" %}</span>
    

2. Call the custom field of the content model

The custom fields of the content model are usually used on the document detail page or list page, Anqi CMS provides various flexible calling methods.

  • Directly call the specified custom field:On the document details page, if you define a "author" field for the article model, you can directlyarchive.authoror{% archiveDetail with name="author" %}to retrieve and display:

    <p>作者:{{ archive.author }}</p>
    {# 或者,如果您想在当前文档之外指定其他文档ID #}
    <p>文章来源:{% archiveDetail with name="source" id="10" %}</p>
    

    For categories, single pages, tags, and similar things, there are also similarcategoryDetail/pageDetail/tagDetailtags to directly call their custom fields. For example, the 'Banner' field of the category:

    <img src="{% categoryDetail with name="Banner" %}" alt="分类Banner">
    
  • Loop to display all custom fields:Sometimes, you may want to dynamically display all the custom parameters of an item in an area (such as a product) without having to call them individually.{% archiveParams %}The tag is designed for this purpose. It will return an array containing all custom field names and values, which you can useforLoop through and display:

    <h3>产品参数详情</h3>
    <ul>
    {% archiveParams params %}
        {% for item in params %}
        <li>
            <span>{{item.Name}}:</span> {# 这是后台设置的“参数名”(中文显示) #}
            <span>{{item.Value}}</span> {# 这是该参数的实际值 #}
        </li>
        {% endfor %}
    {% endarchiveParams %}
    </ul>
    

    This

Related articles

How to automatically convert newline characters in multi-line text in AnQiCMS templates to the HTML `<br/>` tag?

In AnQiCMS template, how to make the newline character of multiline text automatically display as the HTML `<br/>` tag?In website content operation, we often encounter situations where we need to display multi-line text, such as article summaries, product descriptions, or user comments.This text content is usually created by pressing the Enter key when editing in the background.However, when this text containing newline characters (usually `\n`) is directly output to an HTML page, the browser will not parse it as a visual line break.On the contrary, HTML

2025-11-08

How to set a default thumbnail in AnQiCMS to ensure that articles without uploaded thumbnails can still display images?

It is crucial to maintain the visual appeal and consistency of content in website operation.Many times, the articles we publish may not have a specific picture, or the editor may have missed uploading the thumbnail, which may lead to blank pages or inconsistent styles.AnQiCMS (AnQiCMS) has fully considered this user requirement and provided flexible default thumbnail setting features to ensure that even articles without individually uploaded thumbnails can have beautiful image displays.Why do you need to set a default thumbnail?\n\nA default thumbnail is like a "backup plan" for a website.

2025-11-08

How to configure and display structured data (Json-LD) in AnQiCMS to enhance search engine understanding?

In today's digital world, search engines are the main way users discover website content.In order to help search engines better "understand" the content on our website, structured data plays a crucial role.Json-LD (JSON for Linking Data) is a lightweight, easy-to-implement standardized data format that can clearly describe web content in a structured way, thereby enhancing the visibility and display effects of websites in search results.AnQiCMS as a content management system focusing on SEO optimization

2025-11-08

How to set up a canonical link (CanonicalUrl) in article content and ensure it displays correctly on the page?

In website operation, we often encounter situations where content is similar or repetitive, which may not only scatter the search engine's crawling budget, but also dilute the page weight, affecting SEO performance.Fortunately, AnQi CMS provides us with the function to set canonical links (Canonical URL), which can effectively help us solve these problems and clearly inform search engines which page is the 'original' or 'preferred' version of the content.The value of understanding the significance of canonical URL in simple terms

2025-11-08

How to customize the display fields of an Anqi CMS content model to meet specific business requirements?

In website operation, the diversity and personalization of content are the key to attracting users and improving efficiency.AnQiCMS (AnQiCMS) understands this and therefore provides powerful content model customization features, allowing us to flexibly adjust the display fields of content according to specific business needs.This article will take you in-depth to understand how to use this powerful feature to create a content management experience that is more tailored to your business scenario.Why do we need to customize content model fields?You may encounter such a situation: The default "article" or "product" model is general, but in actual operation

2025-11-08

How to implement personalized front-end display for different types of content (articles, products, single pages) in AnQi CMS?

In AnQi CMS, achieving personalized front-end display of different types of content (such as articles, products, and single pages) is one of its core advantages, and it is also a key factor for content operators to achieve brand differentiation and improve user experience.This is mainly due to the flexible content model design and powerful template customization capabilities of Anqi CMS. ### Flexible Content Model: The Foundation of Personalized Display The core of Anqi CMS lies in its "flexible content model".This means you are not limited to fixed "article" or "product" types, but can customize various content models according to your actual business needs. For example

2025-11-08

On the document detail page, how to call and display the custom model field content of the article?

The flexible content model of AnQiCMS (AnQiCMS) is a very powerful tool that allows us to add dedicated fields for different types of content (such as articles, products, events, etc.) based on the actual needs of the website.This means that our content is no longer limited to fixed titles, summaries, and content, but can carry more diverse and structured information.How do we call and display the content of these custom model fields on the document detail page? Next, let's explore the various flexible ways provided by Anqi CMS.###

2025-11-08

How to set up independent display template files for specific articles or categories?

In the daily operation of websites, we often encounter such situations: some articles are in-depth reports, some are promotional pages for events, and some are corporate profiles or product details.They each have unique display requirements, and if they all follow the website's general template, it may seem monotonous and fail to fully exert the appeal of the content.AnQi CMS is an efficient and flexible content management system that fully considers this personalized demand, allowing us to set independent display template files for specific articles, categories, even single pages, making the content display more tailored and impactful.

2025-11-08