How to display custom contact information (such as phone, address, social media) in the template?

Calendar 👁️ 79

The contact information of the website is the key bridge for establishing communication and trust between you and the visitors.Whether it is to seek services, consult products, or simply learn more information, clearly and accurately displaying contact information is crucial for improving user experience.AnQi CMS is an efficient and convenient content management system that provides an intuitive backend management interface and flexible template calling functions, allowing you to easily manage this information and seamlessly present it in various corners of the website.

This article will detail how to set up these key contact information in Anqi CMS, and teach you how to accurately display them in the website template.


Step 1: Manage your contact information centrally in the background

In AnQi CMS, it is recommended to set all contact information that needs to be displayed on the website in the background.The benefit of doing this is that once the information changes, you only need to modify it in one place, and all the places on the website that call this information will be automatically updated, greatly improving management efficiency.

  1. Access the "Contact Information Settings" interfaceLog in to your Anqie CMS backend management interface. In the left navigation menu, find the item 'Backend Settings', click to expand, and you will see a sub-menu named 'Contact Information Settings'.Click to enter, this is the center where you can manage all the contact information of your website.

  2. Enter the default contact informationAfter entering the "Contact Information Settings" page, you will see a series of preset fields that cover the most commonly used contact methods on a corporate website, such as:

    • Contact: Usually the contact person of your company.
    • Contact phone number: Your company's phone number or customer service hotline.
    • Contact address: The detailed physical address of your company.
    • Contact email: Your company's email or customer service email.
    • WeChat IDCompany's WeChat number.
    • WeChat QR codeUpload the QR code image of the company's WeChat service account or personal WeChat.
    • In addition, there are some commonly used social media fields such as QQ, WhatsApp, Facebook, Twitter, Instagram, LinkedIn, YouTube, TikTok, Pinterest, etc. You just need to fill in the accurate information in the corresponding input box.For fields that require uploading images (such as WeChat QR codes), the system provides a convenient upload entry.
  3. Customize more contact methodsThe AnQi CMS fully considers the personalized needs that may exist on different websites.If the default fields do not meet all your requirements, for example, if you need to display a specific customer service link or links to other niche social media platforms, you can use the "custom settings parameters" feature at the bottom of the page.Click to add a new parameter item, you need to fill in three key pieces of information:

    • Parameter NameThis is the unique identifier you use when calling the template.In order to facilitate understanding and maintenance, it is recommended to use meaningful English names, such as 'CustomerServiceLink' or 'LineID'.
    • Parameter valueEnter the actual content corresponding to the parameter, such as a specific URL link, ID number, etc.
    • Note: Add a brief description for this custom parameter to help you remember its purpose.In this way, you can flexibly expand and manage any contact information according to the actual operation needs of the website.

Step 2: Display contact information elegantly in the website template

After saving the contact information in the background, the next step is to display them on the website front-end template. The Anqi CMS template engine is designed to be very intuitive, similar to Django templates, mainly through double curly braces{{变量}}Output content and single curly braces with the percentage sign{% 标签 %}Execute various functions

To display contact information, we will use the built-in Anqi CMS.contactTag. This tag is specifically used to extract data from the "Contact Settings" on the backend. Its basic usage method is{% contact 变量名称 with name="字段名称" %}.

Let us go through some specific examples to see how to present this information on your website.

  1. Call the default contact information (such as phone and address)Assuming you want to display the company's contact information and address in the footer of the website, you can write your template code like this:

    <!-- 假设这是您模板文件中的某个位置,比如页脚 -->
    <footer>
        <p>联系电话:<a href="tel:{% contact with name="Cellphone" %}">{% contact with name="Cellphone" %}</a></p>
        <p>公司地址:{% contact with name="Address" %}</p>
        <p>联系邮箱:<a href="mailto:{% contact with name="Email" %}">{% contact with name="Email" %}</a></p>
    </footer>
    

    In this code block,contactTag throughname="Cellphone"/name="Address"andname="Email"These parameters specify the backend fields to be called. The label will automatically output the corresponding values set in the backend. We will wrap the phone number in<a>Labels, and usetel:The protocol facilitates direct dialing by clicking.

  2. Display social media icons and linksModern websites often integrate social media links. You can use Anqi CMS'scontacttags to easily achieve:

    <div class="social-links">
        {%- contact facebookLink with name="Facebook" -%}
        {%- if facebookLink %}
            <a href="{{ facebookLink }}" target="_blank" rel="nofollow"><img src="/static/images/facebook_icon.png" alt="Facebook"></a>
        {%- endif -%}
    
        {%- contact twitterLink with name="Twitter" -%}
        {%- if twitterLink %}
            <a href="{{ twitterLink }}" target="_blank" rel="nofollow"><img src="/static/images/twitter_icon.png" alt="Twitter"></a>
        {%- endif -%}
    
        {%- contact instagramLink with name="Instagram" -%}
        {%- if instagramLink %}
            <a href="{{ instagramLink }}" target="_blank" rel="nofollow"><img src="/static/images/instagram_icon.png" alt="Instagram"></a>
        {%- endif -%}
    </div>
    

    Here, we define a temporary variable for each social media link, such asfacebookLink), and through{% if facebookLink %}Determine whether the back-end has set the link to avoid displaying an empty link. The image icon needs to be prepared and placed in the static resource directory of the website (such as/public/static/images/Then proceed<img>references.}rel="nofollow"Properties help optimize SEO, indicating to search engines not to track these external links.

  3. Invoke custom contact information (e.g., WhatsApp)If you customize a parameter named 'WhatsApp' in the background, the way to call it in the template is also intuitive:

    {%- contact whatsappLink with name="WhatsApp" -%}
    {%- if whatsappLink %}
        <p>
            <a href="{{ whatsappLink }}" target="_blank">通过WhatsApp联系我们</a>
        </p>
    {%- endif -%}
    

    This code will first try to retrieve the parameter value named "WhatsApp" from the background. If it exists, it will create a paragraph with a WhatsApp link.

  4. Display WeChat QR code imageIf your contact information contains a WeChat QR code, you can directly reference it in the template:

    `twig

    <h4>扫码关注我们</h4>
    {%- contact qrcodeImg with name="Qrcode" -%}
    {%- if q
    

Related articles

How to implement pagination control for content list display in Anqi CMS?

In website operation, how to efficiently display and manage a large amount of content while ensuring a smooth browsing experience is a challenge that every webmaster needs to face.AnQiCMS provides an intuitive and powerful control capability for pagination display of content lists, allowing you to easily achieve an orderly presentation and efficient navigation of content.To implement the pagination display of content lists, we mainly use two core tags in Anqi CMS templates: content list tags (such as `archiveList`, `tagDataList`

2025-11-08

How to display the list of article tags (Tag) and the related articles under each Tag?

AnQi CMS provides very flexible and powerful tools for content organization, among which tags (Tag) are a very intuitive and efficient tool.By using labels reasonably, not only can it help us better manage website content, but also significantly improve user experience and search engine optimization (SEO) effects.Next, let's take a look at how to display the list of article tags in Anqi CMS, as well as the related articles under each tag.### First step: Manage and create tags in the background Before using tags, make sure that our website content has been properly tagged

2025-11-08

How does AnQi CMS display detailed content of a single page (such as About Us, Contact Information)?

In website operation, pages such as "About Us", "Contact Information", and "Privacy Policy" play a crucial role. They are the basis for visitors to show corporate information and establish trust.AnQiCMS as an efficient content management system provides a very flexible and intuitive way to create and display the detailed content of these single pages.

2025-11-08

How to dynamically display the name, description, and link of content categories in a template?

In website operation, clearly displaying content categories not only helps users quickly find the information they need, but is also a key link to improve website usability and search engine optimization (SEO).AnQiCMS (AnQiCMS) with its flexible template engine allows us to easily dynamically call and display the names, descriptions, and links of various content categories in website templates.Today, let's delve deeper into how to achieve this goal in templates, making your website content more vivid and efficient.### Understanding Content Classification in AnQi CMS In the AnQi CMS backend management system

2025-11-08

How to define and display different banner images for different parts of the website in AnQiCMS?

In website operation, banner images are important visual elements that attract visitor attention and convey key information.They can not only enhance the overall aesthetics of the website, but also guide users to browse specific content or participate in promotional activities.AnQiCMS provides a flexible mechanism that allows you to customize and display unique Banner images for different parts of the website, such as the homepage, various thematic category pages, or independent content pages, thereby achieving more refined visual marketing.

2025-11-08

How to use the structured data (JSON-LD) feature of Anqi CMS to enhance the search engine results display?

In today's highly competitive online environment, making a website's content stand out in search engine results pages (SERP) and attract more target users is the goal of every website operator.In addition to keyword optimization, high-quality content, and a good user experience, using structured data (JSON-LD) to "tell" search engines exactly what your content is becoming a key factor in improving website visibility and obtaining rich search results (Rich Snippets).

2025-11-08

Does AnQi CMS support direct arithmetic operations on strings or numbers within templates to affect display?

When building a website, we often need to handle various data, not just simply display it.For example, we may need to calculate the total price of goods, inventory surplus, or dynamically adjust the style of elements based on numerical size.These scenarios naturally lead to a core question: Does Anqi CMS support direct arithmetic operations on strings or numbers in templates, thereby flexibly affecting the display of content?The answer is affirmative. The AnQi CMS template engine cleverly adopts many advantages of the Django template, including direct support for arithmetic operations.

2025-11-08

How to safely display user-submitted HTML content or JS code in a template to prevent XSS attacks?

In website operation, we often need to handle various types of content submitted by users, such as comments, messages, article submissions, etc.This content may contain HTML tags and even JavaScript code. If displayed directly on a webpage, it may introduce cross-site scripting attacks (XSS), posing a security risk to the website.AnQiCMS was designed with comprehensive consideration of content security and provides corresponding mechanisms at the template level to help us effectively prevent such risks.AnQi CMS uses a template engine syntax similar to Django

2025-11-08