In today's website operation, enhancing user experience and convenience is one of the core competencies.When users see phone numbers or email addresses on a website and can directly click to dial or send an email, it will undoubtedly greatly improve efficiency and satisfaction.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 requirement, 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 hyperlinking of phone numbers and email addresses, it does not adopt a one-size-fits-all 'mandatory automatic conversion' approach, but instead provides operators with a variety of refined solutions by combining template tags and powerful filters.

Skillfully use template filters to make content automatically 'come alive'

Imagine that you are writing an article about the 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:...">This 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 in the AnQiCMS template engine. Its function is to intelligently recognize URLs, email addresses, and other text content 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]” such text should be appliedurlizeAfter filtering, these phone numbers and email addresses will 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 displaying article contentarchiveContentyou can use it like thisurlizeFilter:

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

Pass|urlizeThe filter processes, and the phone numbers and email addresses in the text will be automatically recognized and converted to corresponding links. In addition,urlizeit will also be added by default.rel="nofollow"Property, this is a good practice for SEO when pointing to external links. If you worry that the link text is too long and affects the appearance, you can also consider usingurlizetruncFilter 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 of 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 under "Background Settings" in the background -> "Contact Information Settings").Here, you can centrally configure the company's contact information, including contact phone numbers, email addresses, and WeChat numbers.contacttag to retrieve the data.

Although AnQiCMS will not automatically add for these original data when obtaining themtel:ormailto:The protocol prefix, but you can easily manually construct these links based on the data obtained 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 advantages of this method are that you can fully control the display text, style, and whether to add other attributes, providing high flexibility.This is especially applicable to important contact information that needs to be highlighted on the corporate website.

Replace batch content, efficient processing of existing data

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

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

In summary, AnQiCMS automatically adds contact phone numbers and email addressestel:andmailto:The link aspect provides multi-level, high flexibility solutions.Whether it is automatically processing ordinary content through smart template filters, manually building specialized contact information links through template tags, or utilizing batch replacement features to process existing data, AnQiCMS can help you easily achieve this goal, effectively enhancing the website's user experience and operational efficiency.


Common Questions (FAQ)

Q1:urlizeThe filter automatically adds linksrel="nofollow"attributes?

A1: Yes, according to the design of AnQiCMS,urlizeThe filter converts URLs or email addresses in text to HTML<a>when labelingrel="nofollow"Property.This is generally considered good SEO practice, especially when the link points to an external website, as it helps to avoid passing the weight of the current site to unrelated external sites.nofollowto implement the filter.

Q2: How can I display a phone number or email address in the article content without them being automatically linked?

A2: If you wish to display a phone number or email address as plain text and not automatically converted to a link, the most direct method is to avoid using these pieces of information in the text.urlizeFilter. For example, you can place a phone number or email address in a separate variable and output the variable directly without applying iturlizeFor the data obtained from the "Contact Information Settings" on the backend, since they themselves will not automatically convert to links, you only need to output them directly{{ cellphone }}or{{ contactEmail }}without any additional processing.

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

A3:urlizeThe filter usually