How does the `contact` tag display contacts, phone numbers, addresses, and social media links on the AnQiCMS page?

Calendar 👁️ 55

In website operation, clearly and accurately displaying contact information is crucial for building user trust and promoting communication. AnQiCMS provides a very convenient way to manage and display this information, that is, bycontactThe tag can help us easily call the preset contact name, phone number, address, and social media links on any page of the website, without hard coding, greatly improving content management efficiency.

Step 1: Configure contact information in the AnQiCMS backend

Before we start usingcontactBefore the label, you first need to configure the contact information in the AnQiCMS backend. This process is very intuitive:

  1. Log in to the AnQiCMS backend.
  2. Find and click the "Back-end settings" in the left navigation bar.
  3. Select "Contact Information Settings".

Here, you will see a series of predefined fields, such as "contact person", "contact phone number", "contact address", "contact email", "WeChat ID", and "WeChat QR code" and so on.Just fill in your information in the corresponding input box.

It is worth mentioning that the flexibility of AnQiCMS allows you to add custom contact information.If your business needs to display WhatsApp, Facebook homepage or other specific social media links, but there is no corresponding field directly in the background, you can add them through the 'Custom Settings Parameters' feature on this page.For example, you can add a parameter named "WhatsApp" and enter your WhatsApp contact link or number in the "Parameter Value".This way, we can call it later in the template.

Step two: UnderstandcontactBasic usage of tags

contactThe tag is a core component of the AnQiCMS template engine, its basic usage is{% contact with name="字段名称" %}. ThisnameParameters are those field names we configure in the backend "Contact Information Settings" (such asUserName/Cellphone/Addressetc.).

If we want to output some contact information directly in the template, we can use this method. For example, to display the phone number, it can be written as{% contact with name="Cellphone" %}.

In addition, we can also assign the contact information obtained to a variable, so that it can be used multiple times in the template or for more complex processing. At this point, the usage becomes{% contact 变量名称 with name="字段名称" %}{{ 变量名称 }}For example,{% contact myPhone with name="Cellphone" %}{{ myPhone }}.

For users with multiple site management needs,contactTags also supportsiteIdThe parameter can specify contact information for calling a specific site configuration. However, for most single-site users, it is usually unnecessary to pay attention to this parameter.

Step 3: Call the contact information in the page

UnderstoodcontactAfter the configuration and basic usage of the tag, let's see how to display this contact information in the website page.

Display contact name, phone number, and address

You can use to display the contact name, phone number, and address,UserName/CellphoneandAddressField. To make it easy for users to click on the phone number and dial it directly, we can wrap it intel:link.

<p>联系人:{% contact with name="UserName" %}</p>
<p>电话:<a href="tel:{% contact with name='Cellphone' %}">{% contact with name='Cellphone' %}</a></p>
<p>地址:{% contact with name='Address' %}</p>

In the code above,{% contact with name="UserName" %}The contact name you entered in the background will be output directly. The phone number is used to build a clickable phone link.

Display contact email and social media links

For the contact email (EmailAnd various social media links (such asFacebook,Twitter,Instagram,Youtubeare consistent in their calling method. Make sure that you have entered the complete link address (includinghttp://orhttps://)

<p>邮箱:<a href="mailto:{% contact with name='Email' %}">{% contact with name name='Email' %}</a></p>
<p>Facebook:<a href="{% contact with name='Facebook' %}" target="_blank" rel="nofollow">我们的Facebook页面</a></p>
<p>Twitter:<a href="{% contact with name='Twitter' %}" target="_blank" rel="nofollow">关注我们Twitter</a></p>

Please note heretarget="_blank"will open the link in a new tab, whilerel="nofollow"The attribute can tell the search engine not to follow this link, which is used in some SEO strategies.

Display WeChat QR code

If you upload a WeChat QR code image in the background "Contact Information Settings", you can useQrcodefield to display it:

<div>
    <p>微信扫一扫:</p>
    <img src="{% contact with name='Qrcode' %}" alt="微信二维码" style="width: 100px; height: 100px;">
</div>

By this method, users can directly scan the QR code to add your WeChat.

Call a custom field (for example, on WhatsApp)

Suppose you have added a custom parameter named in the "Contact Information Settings" under the backendWhatsAppThe parameter, and filled in the WhatsApp contact link or number in its "parameter value". Then, you can call it in the template like this:

<p>WhatsApp:<a href="{% contact with name='WhatsApp' %}" target="_blank">立即通过WhatsApp联系</a></p>

Make sure the parameter name in the background "Custom Settings Parameters" matches the template innamethe value of the parameter is completely consistent (for exampleWhatsApp)

Summary

contactThe tag is a very practical feature in the AnQiCMS template system, making the management and display of website contact information extremely simple and efficient.By flexibly configuring backend parameters and combining template tag calls, you can easily display contact information in the way you want at any location on the website, thereby better serving your users.Whether it is to display basic contact information or integrate various social media links,contactLabels can provide strong support.


Frequently Asked Questions (FAQ)

Q1: If I change the contact phone number or address in the background, will the front page update immediately?

A1: Yes, usually, AnQiCMS background data is updated

Related articles

How does the `system` tag display the website name, Logo, record number, and copyright information on the AnQiCMS website?

When building and operating a website, the website's name, logo, filing number, and copyright information are important elements that constitute the professional image and legality of the website.They are not only the identity of the website, but also the foundation of user trust.For users of AnQiCMS, the system provides a convenient and efficient way to manage and display these core information, which is through the powerful `system` tag.This article will delve into how to use the `system` tag on the AnQiCMS website to flexibly display the website name, Logo, filing number, and copyright information

2025-11-08

What naming conventions do AnQiCMS template files support to customize the display of specific pages or categories?

In AnQiCMS, in order to achieve personalized display of website pages or categories, we do not always have to write complex logic from scratch. The system provides a very flexible and intuitive naming convention for template files.These conventions allow us to create template files with specific names, enabling the system to automatically recognize and apply them to customize the display of different content types.First, understanding the basic structure of the template file is crucial.All template files are stored in the `/template` directory and use `.html` as the file extension.For example, a set named

2025-11-08

How to include common header, footer, and other code snippets in AnQiCMS templates to unify the display style?

How to include common header, footer, and other code snippets in AnQiCMS templates to unify the display style? When building a website, whether it's a personal blog, a corporate website, or a marketing site, maintaining consistency in page visuals and functionality is crucial.Imagine if each page's top navigation, footer copyright information, and even the sidebar were all different, the user experience would be greatly reduced, and the professionalism of the website would also be greatly reduced.

2025-11-08

How to use the loop (for) tag to traverse and display data lists in AnQiCMS templates?

In AnQiCMS template development, mastering how to effectively display dynamic data lists is the key to building a feature-rich website.Whether it is the latest article, product display, or category navigation, all of these rely on the loop mechanism in the template.AnQiCMS's template system borrows the simplicity and power of Django's template engine, with the `for` loop tag being the core tool for data traversal.### Understanding the basics of `for` loop tags When we need to repeatedly display a series of structurally similar data on the page, the `for` loop comes into play

2025-11-08

How to dynamically generate and display the page's Title, Keywords, and Description in AnQiCMS using the `tdk` tag?

In website operation, Title, Keywords, and Description (abbreviated as TDK) are the foundation of Search Engine Optimization (SEO).They not only describe the page content to search engines, but also directly affect the click intention of users on the search results page.AnQiCMS as a content management system focused on, deeply understands the importance of TDK, and therefore provides a powerful and flexible mechanism that allows users to easily dynamically generate and finely manage the website TDK.### How to manage TDK in AnQiCMS

2025-11-08

How to build and display a multi-level navigation menu using the `navList` tag on the AnQiCMS website?

The website navigation is an important guide for users when they visit the website. It not only helps users find the information they need quickly, but also reflects the clear structure and friendly user experience of the website.In AnQiCMS, building flexible and diverse navigation menus is a relatively simple and efficient task, mainly due to its powerful `navList` tag.Whether it is a simple single-layer menu or a complex two-level dropdown menu, the `navList` tag can provide strong support.### `navList` label

2025-11-08

How does the `breadcrumb` tag display the breadcrumb navigation path of the AnQiCMS page?

In website operation, clear navigation is a key factor in improving user experience and helping search engines understand the structure of the website.This is a direct navigation aid that can clearly show the hierarchical path of the current page, allowing visitors to always know where they are and where they can go.For users who use AnQiCMS to build and manage websites, achieving such navigation is simple and efficient, thanks to its built-in `breadcrumb` tag.###

2025-11-08

How to retrieve and display the list of AnQiCMS articles or product categories using the `categoryList` tag?

Build a feature-rich, content-packed website in AnQiCMS, categories are an indispensable part of organizing content.Whether it is to display articles, products, services, or build navigation menus, a clear classification structure can greatly enhance the user experience and maintainability of the website.Today, let's delve deeply into a very practical and flexible tag in AnQiCMS——`categoryList`, which can help you easily obtain and display a list of articles or product categories.The `categoryList` tag is a powerful tool in the AnQiCMS template engine

2025-11-08