How to display the contact information set in the website backend on the front page of AnQi CMS?

Calendar 👁️ 67

When using Anqi CMS to build a website, displaying the contact information set in the background to the front-end of the website is a key step to improving user experience and building trust.Aqit CMS provides a very intuitive and flexible way, even without a strong technical background, it can be easily implemented.

Configure the contact information in the website backend

Firstly, you need to configure the contact information in the Anqi CMS backend management interface.Generally, you can find the 'Backend Settings' in the left navigation bar, and clicking on it will show the 'Contact Information Settings' option.

Enter this interface, you will see some preset contact information fields, such as "contact personThese fields cover the most commonly used contact methods on corporate or personal websites, just fill in your information in the corresponding input boxes.For example, you can enter the company's customer service phone number in the 'Contact Phone' field, and the consultation email address in the 'Contact Email' field.

In addition to these default fields, Anqi CMS also allows custom contact information to be added based on specific needs.For example, if you want to display WhatsApp contact information or a link to a social media homepage on your website, you can find the custom parameter settings at the bottom of the page.Click to add a new setting item, you need to fill in three parts: "Parameter name", "Parameter value", and "Note".The parameter name is the unique identifier used when calling the template in the future, it is recommended to use English or pinyin, for example, “WhatsApp”.The parameter value is the specific content of the contact information, such as your WhatsApp number.Note" is used to describe the purpose of the parameter, convenient for future management.

After completing the entry and customization of all contact information, remember to click Save to ensure that your settings take effect.

Call contact information in the website front-end template.

After completing the background configuration, the next step is to call this information in the template files of the website front end. Anqi CMS provides a special template tag for this:contact.

ThiscontactThe usage of tags is very concise and clear. Its basic syntax is{% contact 变量名称 with name="字段名称" %}. Among them,变量名称Optional, if set, it can be used to further process the data; if not set, the tag will directly output the value of the corresponding field.字段名称It is the parameter name corresponding to the parameter in the background settings, for example, the parameter name corresponding to 'Phone number' isCellphone,“Email contact” corresponds to the parameter name isEmail.

Let's look at some specific call examples:

To display the contact phone number, you can write it like this in the template:

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

If you want the phone number to be clickable and dialable, you can combine it with HTML'stel:protocol:

<p>联系电话:<a href="tel:{% contact with name="Cellphone" %}" rel="nofollow">{% contact with name="Cellphone" %}</a></p>

It's similar to display the contact email:

<p>电子邮件:<a href="mailto:{% contact with name="Email" %}">{% contact with name="Email" %}</a></p>

For image information like WeChat QR codes, since the tag directly outputs the image URL, it usually needs to be combined with<img>Label to display. In addition, to prevent HTML content from being escaped, it is usually used with|safeThe filter is used:

<div class="wechat-qr">
    {% contact qrcode_url with name="Qrcode" %}
    {% if qrcode_url %}
        <img src="{{ qrcode_url|safe }}" alt="微信二维码" width="120" height="120">
    {% endif %}
</div>

Here we define a variableqrcode_urlStore the link of the QR code image, then check if it exists, and then insert it into<img>label'ssrcthe attribute.

For the custom contact information you add in the background, such as the WhatsApp mentioned earlier, the calling method is similar, just make surenameThe parameter matches the parameter name you have set:

<p>WhatsApp:{% contact with name="WhatsApp" %}</p>

By these flexible calling methods, you can place contact information on the website's header, footer, contact us page, or any place where it needs to be displayed, ensuring that visitors can easily and quickly contact you.

Summary

AnQi CMS through its intuitive backend configuration and powerful template tags greatly simplifies the management and display of website contact information.Whether it is the commonly used fields provided by default or the unique contact methods customized according to business needs, they can be efficiently and flexibly presented on the website front-end, helping you better communicate with users and improve the practicality and user experience of the website.


Frequently Asked Questions (FAQ)

  1. Q: Why did the front-end page not update immediately after I modified the contact information in the background?A: This is likely due to system caching.The AnQi CMS aims to improve website access speed by caching page content.You can find the 'Update Cache' option in the left navigation bar of the background management interface, click to clean, usually you can see the latest content.

  2. Q: I added custom contact information, but it does not display in the template or shows an error. How should I troubleshoot?A: Please carefully check the following points:

    • Is the parameter name consistent:Make sure you use in the template tag{% contact with name="字段名称" %}。“字段名称It should be exactly the same as the parameter name you entered when customizing parameters in the background “Contact Information Settings”, including case sensitivity。“
    • Whether to save:After confirming the addition or modification of contact information in the background, the save button has been clicked.
    • Clear the cache:Similarly, the update of custom fields may also be affected by the cache, try clearing the cache.
  3. Q: Can contact label be used to determine if a contact exists besides directly displaying text?A: Okay. You can first assign the value of the contact information to a variable, and then use the template's conditional judgment (iflabel) to check if the variable is empty. For example:

    {% contact phone_num with name="Cellphone" %}
    {% if phone_num %}
        <p>联系电话:{{ phone_num }}</p>
    {% else %}
        <p>暂无联系电话</p>
    {% endif %}
    

    Such, only when the background has set the phone number, will the phone information be displayed.

Related articles

How to use the `system` tag to retrieve and display the global information of a website, such as the website name, Logo, and filing number?

It is crucial to maintain the consistency of brand image and the accuracy of information in website operation.AnQi CMS is an efficient content management system that provides us with a convenient way to manage and display these core information.Today, let's delve into how to use the `system` tag of Anqi CMS to easily obtain and display global information on the website template, such as the website name, Logo, and filing number.

2025-11-09

How to format a timestamp into a readable date and time using the `stampToDate` tag in AnQi CMS?

In website operation, the display of time information is crucial. Whether it is the publication date of articles, the update time of products, or the submission time of comments, a clear and easy-to-read date and time format can greatly enhance the user experience.The original timestamp is machine-friendly, but it is cryptic to ordinary visitors.Fortunately, AnQiCMS (AnQiCMS) provides a very convenient template tag——`stampToDate`, which can easily format timestamps into the date and time we are familiar with.### `stampToDate` label

2025-11-09

How to implement diverse data layout and display with the `for` loop tag in AnQi CMS?

How to present information in a more rich and attractive way during website content operation is the key to improving user experience and site activity level.AnQiCMS (AnQiCMS) provides us with the tool to achieve this goal with its flexible content model and powerful template engine.Among them, the `for` loop iteration tag is the essential core tool for us to perform diverse formatting and display.Imagine your website is not just a static pile of articles, but can intelligently present lists of articles, product galleries, category navigation, user comments, and even custom parameters based on different scenarios

2025-11-09

What are some practical scenarios for using the `if/else` logical judgment tags in AnQi CMS to control content display conditions?

In AnQi CMS template design, the `if/else` logical judgment tag is an extremely powerful tool that endows the website content with the vitality of dynamic display.By flexibly using this tag, we can intelligently control the display and hiding of elements on the page based on different conditions, thereby providing users with more accurate and personalized browsing experiences, and also greatly improving the operational efficiency of the website.Imagine if your website needs to display different content for different scenarios or if certain information is only visible under specific conditions

2025-11-09

How to dynamically set the `title`, `keywords`, and `description` metadata of a page using the `tdk` tag?

In the practice of website operation and search engine optimization (SEO), page metadata plays a crucial role.Among them, the page title (`title`), keywords (`keywords`), and description (`description`) directly affect the display effect and the willingness of users to click on the search engine results page.AnQiCMS (AnQiCMS) fully understands its importance and provides a powerful and flexible `tdk` tag to help us dynamically and efficiently manage these key metadata.

2025-11-09

How does Anqi CMS ensure that static rules (such as model naming patterns) are correctly generated and displayed in URLs?

In website operation, a clear and friendly URL address not only allows visitors to understand the page content at a glance but is also an indispensable part of search engine optimization (SEO).A well-structured URL can help search engines better understand the page topic, thereby improving the crawling efficiency and ranking of the website.Our CMS deeply understands this, providing a simple, easy-to-use, and highly flexible solution for generating and displaying static rules.

2025-11-09

How to implement the correct rendering and style display of Markdown content in AnQi CMS template?

Markdown is favored by content creators for its concise and efficient characteristics.In AnQi CMS, using Markdown not only allows for quick content creation but also enables simple configuration to perfectly display these contents on the frontend page, including rich styles, mathematical formulas, and even flowcharts.This article will introduce in detail how to make your Markdown content render correctly and have a beautiful style in the Anqi CMS template.Enable Markdown editor First

2025-11-09

How does AnQi CMS generate and display thumbnails of different sizes for image resources?

In website operation, the loading speed and display effect of images directly affect user experience and search engine optimization.Especially for content management systems with a large number of images, how to efficiently generate and display thumbnails of different sizes is a crucial function.AnQiCMS (AnQiCMS) provides a flexible and powerful solution in this regard, making it easy to manage and display image resources. ### Core Advantage: Intelligent Generation and Flexible Upload AnQiCMS does a very good job in handling image resources.It is the most reassuring feature

2025-11-09