In today's website operations, improving user experience and convenience is one of the core competitive advantages.When a user sees a phone number or email address on a website, if they can click to dial or send an email directly, it will undoubtedly greatly improve efficiency and satisfaction.Then, does AnQiCMS (AnQi Content Management System) support automatically adding contact phone numbers and email addresses on the website?tel:andmailto:Where is the link? As an experienced website operations expert, I can confidently tell you that AnQiCMS provides a flexible mechanism to meet this need, making your website content more interactive.

AnQiCMS as an efficient and customizable enterprise-level content management system, has powerful functions in content display and management.For the linkification of phone numbers and email addresses, it does not take a one-size-fits-all approach to 'mandatory automatic conversion', but instead provides operators with a variety of refined solutions by combining template tags and powerful filters.

Skillfully using template filters to make content automatically 'alive'

Imagine you are writing an article about a company's services, in which you mentioned a customer service phone number or email address. Traditionally, you might need to manually convert it to<a href="tel:...">or<a href="mailto:...">Such a link, it is not only cumbersome but also prone to errors. But in AnQiCMS, with the help of powerful template filters, such asurlizeThis process can become exceptionally simple and automated.

urlizeThe filter is a very practical feature of the AnQiCMS template engine. Its function is to intelligently identify URLs, email addresses, and other text content in the text and automatically convert them into clickable HTML<a>Label. This means that when your article content, product description, or other text fields contain text like “请致电 138-8888-8888or联系我们:[email protected]urlizeAfter the filter, these phone numbers and email addresses will automatically become clickable links on the front-end page, respectively.tel:138-8888-8888andmailto:[email protected].

For example, in your template, if you have a variable to display article contentarchiveContentyou can use it like thisurlizeFilter:

<div>
    {{ archiveContent|urlize|safe }}
</div>

By|urlizeThe filter processes, automatically recognizing and converting phone numbers and email addresses in the text into links. In addition,urlizeit will also default to addingrel="nofollow"Attribute, this is a good practice when pointing to external links in SEO. If you are worried that the link text is too long and affects the appearance, you can also consider usingurlizetruncA filter that can truncate the displayed link text to a specified length while converting links, keeping the page neat.

Flexible configuration of dedicated contact information, precise control over link format.

In addition to automatically recognizing in ordinary content, AnQiCMS also provides a special "Contact Information Settings" function for managing corporate contact information (located in the "Background Settings" -> "Contact Information Settings").Here, you can centrally configure the company's contact information, phone number, email address, and WeChat ID.When you need to display these preset contact information on the website header, footer, or "Contact Us" page, you can usecontactLabel to retrieve data.

Although AnQiCMS will not automatically add it when retrieving these original data.tel:ormailto:Prefix of the protocol, but you can easily manually build these links based on the data you obtain in the template. For example, if you want to display clickable phone numbers and email addresses on the page, you can do it like this:

{# 获取联系电话 #}
{% contact cellphone with name="Cellphone" %}
{# 获取联系邮箱 #}
{% contact contactEmail with name="Email" %}

{# 在页面中构建链接 #}
<div>
    联系电话:<a href="tel:{{ cellphone }}">{{ cellphone }}</a>
</div>
<div>
    联系邮箱:<a href="mailto:{{ contactEmail }}">{{ contactEmail }}</a>
</div>

The advantage of this method is that you can completely control the display text, style, and whether to add other attributes, providing great flexibility.This is particularly applicable to the important contact information that needs to be highlighted on the corporate website.

Replace batch content, efficiently handle existing data

For those who have accumulated a large number of unformatted phone numbers or email addresses before the introduction of AnQiCMS, or during the operation of the website, you do not need to manually modify them.The "Content Replacement" feature provided by AnQiCMS (located in the "Function Management" section of the backend -> "Content Keyword Replacement") can help you efficiently batch process this data.

This feature supports searching and replacing specified keywords or patterns according to preset rules. AnQiCMS even comes with built-in support for{电话号码}and{邮箱地址}Such regular expression recognition rules. You can configure the replacement rules to replace the matched plain text phone numbers with<a href="tel:...">...</a>format, or replace email addresses with<a href="mailto:...">...</a>Format. This is a powerful backend tool suitable for performing one-time or periodic batch updates on website historical content, ensuring that all relevant information has good interactivity.

In summary, AnQiCMS automatically adds to the contact phone number and emailtel:andmailto:Link-wise, it provides multi-level, high flexibility solutions.Whether it is through the automatic processing of ordinary content by intelligent template filters, or manually constructing special contact information links through template tags, or using the batch replacement function to process existing data, AnQiCMS can help you easily achieve this goal, thereby effectively improving the user experience and operational efficiency of the website.


Frequently Asked Questions (FAQ)

Q1:urlizeThe filter automatically adds to the linksrel="nofollow"Should I add the attribute?

A1: Yes, according to the design of AnQiCMS,urlizeThe filter converts URLs or email addresses in text to HTML<a>Labels are automatically added for it,rel="nofollow"Attributes. This is usually considered a good SEO practice, especially when links point to external websites, as it helps avoid passing the current site's weight to unrelated external sites.If you have special requirements and do not want to add this attribute, you may need to use custom template logic or check if there are other attributes that do not addnofollowto implement the filter.

Q2: How do I display a phone number or email address in an article content without having them automatically linked?

A2: If you want phone numbers or email addresses to be displayed as plain text and not automatically converted to links, the most direct method is to avoid using these pieces of information in the text.urlizeFilter. For example, you can place the phone number or email address in a separate variable and output the variable directly without applying iturlize. For the data obtained from the background "Contact Information Settings", since they themselves do not automatically convert to links, you just need to output them directly{{ cellphone }}or{{ contactEmail }}and no additional processing is required.

Q3:urlizeCan the filter recognize phone numbers and email addresses in all formats?

A3:urlizeThe filter usually