Why did I use the `{% contact %}` tag in the AnQiCMS template but the content did not display on the front end?

Calendar 👁️ 62

As an experienced website operations expert, I know that when managing and maintaining a website, even a small template tag problem may confuse and worry the operator. Today, let's delve into a problem that occasionally occurs in AnQiCMS (AnQi CMS) users: the use of{% contact %}Labels, but the front-end page does not display any content. Don't worry, this is usually not a big deal, just follow the steps to investigate and you will find the cause and solve it quickly.

In AnQiCMS template{% contact %}Label does not display content? Senior operation expert for you to analyze

In AnQiCMS,{% contact %}Tags are used to facilitate quick calls to the preset or custom contact information in the background "Contact Information Settings" on the website front-end.It greatly simplifies the maintenance of the bottom, sidebar, or "contact us" page content of a website.However, when you eagerly add it to the template, you find that the page is empty, which is indeed perplexing.

This kind of situation where the 'label exists but the content disappears' is often caused by the following aspects:

1. Improper use of labels: The most common 'carelessness'

AnQiCMS template tag design aims to provide flexibility, but this also means there are certain requirements for usage. For{% contact %}A label does not act like a universal switch and can be directly input{% contact %}It can display all contact information at once. On the contrary, you need to clearly tell it which specific contact method you want to display.

According to the design conventions of AnQiCMS,{% contact %}the tag needs to be配合nameto specify the field name to be called. For example, if you want to display the contact phone number, the correct syntax should be{% contact with name="Cellphone" %}If you only wrote{% contact %}withoutnamethe parameter, then the template engine does not know exactly what information you want to get, and therefore cannot display any content.

Check if you have missed anythingnameOr, parameter,nameDoes the name of the field after the parameter match the system preset or the field name you have customized in the background?

The system preset field names include:UserName(Contact),Cellphone(Contact phone),Address(Contact address),Email(Contact email),Wechat(WeChat ID),Qrcode(WeChat QR code) and so on.

2. Back-end "Contact Information Settings" content is missing or mismatched

Even if your tag usage is completely correct, if the background data itself is empty, or if the field you call is not set at all in the background, then the front-end naturally cannot display it.

Please go to the AnQiCMS backend, navigate to“Backend Settings” -> “Contact Information Settings”page. Check carefully:

  • Are you filling in the corresponding field (such as the field for "Contact Phone" corresponding toCellphone) with content?Many times, the operator may have just created the field but forgotten to assign a value to it.
  • If you are calling the custom contact method field, please confirm that the "parameter name" of the field matches the one in your templatenameThe value of the parameter must be completely consistent.For example, if you have customized a named "WhatsApp contact method" in the background, with the "parameter name" beingWhatsAppthen the corresponding call in the template should be{% contact with name="WhatsApp" %}. Parameter names are case-sensitive, any spelling error may cause them not to be displayed.

3. The 'trickery' of the caching mechanism.

AnQiCMS as an enterprise-level CMS, in order to improve access speed and system performance, it will inevitably introduce a caching mechanism.This means that even if you modify the contact information or template code in the background, the front-end page may not be immediately updated due to the loading of old cache data.

If the label usage and backend settings are confirmed to be correct, it is likely a cache issue.

The solution is quite simple: go to the AnQiCMS backend, click the 'Update Cache' button in the left navigation bar, and clear the system cache.After that, refresh your website's front page, and the content should usually appear.Sometimes, the browser's own cache may be at fault, and clearing the browser cache or accessing in incognito mode can be very helpful.

4. The 'Site ID' mystery in a multi-site environment

If you are using the multi-site management feature of AnQiCMS, and{% contact %}Tags are used to try to obtainother sitesIf you need to specify your contact informationsiteIdParameter.

{% contact 变量名称 with name="字段名称" siteId="X" %}

Among themXIs the ID of your target site. However, this situation is relatively rare, most of the time we are getting the contact information of the current site from the template of the current site, at this timesiteIdThe parameter can be omitted. However, if your website is a multi-site architecture and there is a need for cross-site template calls, this is indeed a factor that needs to be considered.

5. Template file loading or parsing exception

It is not very common, but if there are syntax errors in your template file itself, or if AnQiCMS encounters problems when loading or parsing the template, it may also cause some tags to be rendered incorrectly.However, if it is in this case, it is usually accompanied by more obvious error messages or layout confusion.

Solution strategy:

  1. Check each one by one:Always start with the simplest and most common reasons. First, check the tag syntax (nameParameter, followed by background data, then clear the cache.
  2. Check carefully:Especially field names, distinguish uppercase and lowercase, avoid spelling errors.
  3. Take small steps quickly:If you are a newly added tag, you can first test it on a blank test page or in an area that does not affect the main site.
  4. Check the log:If all the above methods fail, you can try to view the AnQiCMS system log (usually located in the AnQiCMS deployment directory on the server)running.logorerror.log),may have more detailed error information.

By following these troubleshooting steps, you should be able to find{% contact %}The specific reason why the label does not display the content, and successfully solve the problem, so that the visitor can see the complete information of your website.


Frequently Asked Questions (FAQ)

  1. Ask: I have set up a custom contact method in the background, such as 'Customer Service QQ', how do I call it in the template? Answer:In the background "Contact Information Settings", the "parameter name" you fill in for the custom field is the one in the templatenameThe value of the parameter. For example, if the parameter name of "Customer Service QQ" isServiceQQThat is called in the template{% contact with name="ServiceQQ" %}Make sure the parameter name matches with the one in the templatenameThe values must match exactly (including case).

  2. Question: Why can I write directly in the template{% contact %}Nothing is displayed? Answer: ": {% contact %}The label needs to benameThe parameters must explicitly specify the specific contact information field you want to retrieve. For example, to display the phone number, it needs to be written as{% contact with name="Cellphone" %}. If missingnameThe parameter, the template engine does not know which field you want to retrieve, so it will be displayed as empty.

  3. Ask: I have updated the content in the background 'Contact Information Settings', but the front page is still old. What should I do? Answer:This is likely a system cache issue.Please log in to the AnQiCMS backend, click the 'Update Cache' button in the left navigation bar, and completely clear the system cache.After that, refresh your website's front page, and if the browser also has a cache, please clear it or access in incognito mode, you should be able to see the latest content usually.

Related articles

How to use AnQiCMS's `{% system %}` tag and `{% contact %}` tag to combine and display the global contact information of the website?

As an experienced website operations expert, I know that effectively and uniformly managing website content is the foundation of success in an increasingly complex network environment.AnQiCMS (AnQiCMS) leverages the efficient and flexible customization capabilities of the Go language to provide us with many conveniences.Today, let's delve deeply into two seemingly simple but extremely powerful tags in Anqi CMS - `{% system %}` and `{% contact %}`, as well as how to skillfully combine them to build a unified and easy-to-maintain website global contact information display system

2025-11-06

The `{% contact %}` tag supports which filters to format the output content?

As an experienced website operation expert, I know that how to flexibly display and process information in a content management system is the key to improving website user experience and operational efficiency.AnQiCMS (AnQiCMS) provides us with great convenience with its powerful template engine and rich tag system.Today, let's delve into the `{% contact %}` tag and how to make your website's contact information display more exquisite and practical through its output content filters.

2025-11-06

If an AnQiCMS contact field is empty, how can you display default text in the template instead of leaving it blank?

## AnQiCMS template optimization: How to cleverly display default text when the contact information field is empty?In website operation, maintaining the integrity of website content and user experience is crucial.AnQiCMS (AnQiCMS) provides a solid foundation for building various websites with its flexible content management and powerful template functions.

2025-11-06

How to use `{% if %}` in AnQiCMS template to determine if a contact field exists or is not empty?

In the AnQiCMS template, we often need to decide whether to display a certain area or present information in a different way based on the presence or absence of content.This is especially critical for sensitive and important information such as contact details, we never want to leave a bunch of empty titles or broken links on the page.Today, as your website operations expert, I will take you in-depth to understand how to cleverly use the `{% if %}` tag in AnQiCMS templates to determine whether the contact information field exists or is not empty, making your website interface more intelligent and friendly.

2025-11-06

After updating the contact information on the AnQiCMS backend, why didn't the front end take effect immediately?

Hello! As an experienced website operation expert, I fully understand the confusion and anxiety you may feel when you find that the front-end does not take effect immediately after updating the AnQiCMS backend settings.This is a very common phenomenon in website operation, usually not a system failure, but a mechanism designed to improve website performance and user experience is at work.Today, let's delve into the possible reasons behind this and provide a detailed solution.### AnQiCMS Back-end contact information update, why does the front-end not take effect immediately

2025-11-06

What are the common configuration mistakes between AnQiCMS contact information settings and the `contact` tag call?

## Common Misconfigurations in Setting up AnQi CMS Contact Information: Make Your Contact Information Clear and Visible Displaying contact information clearly and effectively in website operations is a key step in building user trust, promoting communication, and transforming business. AnQiCMS provides a convenient backend setting and template tag, allowing you to easily manage and call these key information.However, even such convenient features are often hindered by seemingly minor configuration mistakes, resulting in contact information not displaying properly on the front page, causing confusion for operators

2025-11-06

How to test the `siteId` parameter to correctly identify and call data in the multi-site contact information tag?

The AnQi CMS, as a powerful enterprise-level content management system, undoubtedly provides great convenience and flexibility to operators with its multi-site management capabilities.How to ensure that each site can accurately call its exclusive information when managing multiple brands or sub-sites, especially for such critical data as contact information, it is particularly important.Today, let's delve into how to test and verify the recognition and data call of the `siteId` parameter in contact label tags in a multi-site environment.### Recognize `siteId`

2025-11-06

Can AnQiCMS's anti-crawling feature effectively protect contact information from malicious crawlers?

Certainly, as an experienced website operation expert, I am more than happy to delve into the anti-crawling function of AnQiCMS and explain in detail how it effectively protects your website contact information. --- ## AnQiCMS anti-crawling function: Build a solid barrier for your contact information In today's digital age, information collection has become a norm, but the harvesting of website contact information by malicious crawlers has brought many troubles to enterprises, such as spam emails, harassment calls, and so on.

2025-11-06