In the digital age, an efficient and professional website is the key bridge for communication between a company and its users.AnQiCMS (AnQiCMS) is an enterprise-level content management system based on the Go language, which is proficient in this field. It not only provides powerful content management capabilities but also considers the operator's needs in detail.Today, let's delve into a seemingly simple yet extremely practical feature: how to add custom parameters in the contact information settings of AnQiCMS to make your website information display more flexible and tailored to business needs.

Flexible configuration, make contact information no longer monotonous

In website operation, the contact information of the enterprise is the cornerstone of building trust and promoting communication.However, the preset contact method field often fails to meet the personalized needs of all enterprises.Maybe you need to display a dedicated WhatsApp number, or a specific Telegram ID, or even an account for an uncommon industry communication platform.AnQiCMS knows the importance of personalization, therefore it provides a highly flexible custom parameter function, allowing your contact information settings to perfectly fit the business scenario.

To start customizing your contact information, first you need to log in to the AnQiCMS admin interface. In the left menu bar of the backend, find and click on the "Backend settings”,随后在弹出的选项中选择“English”Contact information settings.

After entering the "Contact Information Settings" page, you will see some commonly used contact information fields preset by AnQiCMS, such as contact person, phone number, contact address, contact email, WeChat ID, and WeChat QR code, etc.These default fields can meet most basic needs, making it convenient for you to quickly fill in and display the core contact information of the enterprise.

添加自定义参数:拓展您的沟通渠道

The true flexibility is reflected in the "Custom settings parameters" area.This is the stage where you create a dedicated contact method according to specific business needs.You can imagine, your business needs to highlight a specific "customer service hotlineThese can all be easily achieved through custom parameters.

在自定义参数的设置过程中,有几个关键要素需要您注意:

首先是“English”Parameter nameEnglishThis is the unique identifier used when calling this custom contact method in the template.customer hotline,system will automatically handle it asCustomerHotline)。Although the system also supports Chinese parameter names, from the perspective of long-term maintenance and development, using English naming will be a better practice.

the next is “parameter valueThis is the specific content you hope to display on the website frontend. For example, if you set the parameter name to 'Customer Service Hotline', then you can fill in the parameter value with400-123-4567If the parameter name is “Skype ID”, then the parameter value can be your Skype username.

Finally is “[en] NoteEnglishThis field will not be displayed on the website front-end, it is purely for your and your team's better understanding of the purpose and meaning of this parameter.Clear remarks can effectively improve the efficiency of backend management, especially when there are many custom parameters, which can help you quickly identify the function of each parameter.

For example, suppose you want to add a dedicated "Customer Service Hotline" phone number on your website. Simply click add in the "Custom Setting Parameters" area, then fill in the column forCustomerHotlineEnglish, in the 'Parameter Value' field enter400-123-4567And note '24-hour customer service hotline' in the 'Remarks' section. This way, a brand new custom contact method is configured.

Display custom parameters on your website

It is not enough to just set the parameters in the background; you also need to present them on the website's frontend page to truly make them effective.AnQiCMS through concise and powerful template tags, makes this process effortless.

In your template file, AnQiCMS provides a namedcontactThe dedicated tag, acting as a bridge between backend contact settings and frontend display.Whether it is the default contact method or the custom parameter you just created, it can be invoked through this tag.

To call a default contact method, such as a phone number, you can write it like this:

<span>联系电话:{% contact with name="Cellphone" %}</span>

Here,name="Cellphone"Specified the preset 'Contact Phone' field you want to retrieve.

While for your custom parameters, the calling method is also intuitive. For example, the 'Customer Service Hotline' parameter we set before, its parameter name isCustomerHotline. In the template, you can call it like this:

<span>客服专线:{% contact with name="CustomerHotline" %}</span>

The system will accurately output here according to the 'parameter value' you set in the background400-123-4567.

If you operate multiple sites and want to call the contact information of other sites on a specific sitecontactLabels are supportedsiteIdParameters, allowing you to precisely control the data source, but usually, you do not need to manually specify this parameter.

Enhance user experience and operational efficiency

Through the custom contact method set by AnQiCMS, your website will be able to provide richer and more user-friendly communication channels.This not only enhances user experience and increases user stickiness, but also significantly improves the efficiency of enterprises in handling inquiries and services.Whether it is for multi-language communication channels for global business or for exclusive service channels for segmented markets, this feature of AnQiCMS can provide you with strong support.

Common Questions and Answers (FAQ)

1. Can I use non-English characters as 'parameter name'? For example, use 'customer service hotline'?AnQiCMS supports you to input non-English characters as "parameter name", and the system will automatically convert it to camel case naming for template calls. For example, if you enter "customer service hotline", the system may internally process it asKeFuZhuanXianor similar. However, to maintain the consistency and readability of the template code, we stillstrongly recommendUse English letters as parameter names. This helps to avoid potential encoding issues and makes it easier for developers to maintain templates.

2. Why doesn't the website front-end display the custom parameters I added?This usually has several reasons:

  • Cache issue:Please first try to clear the AnQiCMS system cache. Find "Update Cache" in the top menu bar of the background and click it. It is also recommended that you clear the browser cache.
  • Template invocation error:Check if the custom parameter calls in your template file{% contact with name="..." %}are correct. Make surenameThe value of the attribute is exactly the same as the "parameter name" set in the background (note the case).
  • The template file has not been updated:Make sure that the template file you have modified has been correctly uploaded to the server and is effective.
  • Front-end code missing:You may have set the parameters only in the backend, but did not add the corresponding in the front-end HTML/Twig template.contactTag to display it.

3. How to add an icon next to a custom contact method?AnQiCMScontactThe label is responsible for outputting the 'parameter value' text content that you set in the background. If you want to add an icon next to the text, this needs to be done in your template file, surroundingcontactLabel output, manually implemented using HTML and CSS. For example:

<span class="contact-item">
    <i class="fas fa-headset"></i> <!-- 这是一个Font Awesome图标示例 -->
    客服专线:{% contact with name="CustomerHotline" %}
</span>

You need to include the CSS file of the corresponding icon library (such as Font Awesome) in the website and control the size and color of the icons through CSS styles.