In the daily use of AnQi Content Management System (AnQiCMS), template filters are an important tool for processing and displaying data. Among them,urlizeThe filter is often used for its convenience, automatically converting URLs and email addresses in text content to clickable hyperlinks, and automatically addingrel="nofollow"Property, this is very useful for processing user-generated content (UGC) or automatically identifying links in the text of articles.
urlizeThe role and common usage of filters.
Based on the AnQiCMS document description,urlizeThe core function of the filter is to intelligently recognize link patterns in text. It can recognize complete URLs containing protocols such ashttp:///https://), withwww.The domain prefix, as well as the naked domain without any prefix (for examplekandaoni.com). It can also convert email addresses (such as[email protected]) intomailto:Links. These automatic conversions greatly simplify the content editing and publishing process, especially when dealing with large amounts of unstructured text quickly.
For example, using in templates.urlizeWhen filtering, if the text contains:
https://www.kandaoni.comwww.kandaoni.comkandaoni.com[email protected]
afterurlizeAfter filtering, they will all be automatically added with:<a>Tags, turning them into clickable links and附带rel="nofollow".
urlizeFilter support for URL in IP address format
We understand that users may have questions, in certain specific scenarios, such as internal network access, test environments, or the integration of special services, IP address-based URLs may occur, such ashttp://192.168.1.1or192.168.1.1So,urlizeCan the filter recognize and convert this type of link?
By carefully reviewing the AnQiCMS documentation, we can findurlizeThe example of the filter focuses on URLs in the traditional domain name format, and does not explicitly mention whether it supports recognizing and converting URLs in the IP address format. From its recognitionhttp:///https://Prefix and protocolwww.Looking at the logic of domain prefix, for IP addresses that include the complete protocol, such ashttp://192.168.1.1Due tohttp://The explicit indication of the protocol, itMay beIt can be recognized as a link. However, for bare IP addresses without a protocol prefix, such as192.168.1.1since it does not conform to the common domain structure pattern (missingwww.or top-level domain suffix),urlizeFilterIt is very likely not to be able toIdentify it as a clickable link.
Prudent advice and **practice
Given that the document does not explicitly state support for URLs in IP address format, for safety reasons, we do not recommend relying on it completelyurlizeThe filter automatically converts links in IP address format, especially for those critical links that must ensure accessibility.
In content operation, if you need to display a URL in IP address format and ensure it is clickable, the most reliable method is to use standard HTML<a>Label manually create a link. For example:请访问 <a href="http://192.168.1.1" rel="nofollow">http://192.168.1.1</a> 进行配置。This ensures the accuracy and stability of the link, avoiding the problem of link failure due to differences in filter recognition rules.
urlizeThe filter is designed for convenience, mainly used to process user input or extract common public links from unstructured text.For links that are structured, critical, or have special formatting, manually writing HTML is still**a practice, which can provide more precise control and stronger stability.
Frequently Asked Questions (FAQ)
Ask: Why
urlizeThe filter may not be able to recognize bare IP addresses (such as192.168.1.1)?Answer:urlizeThe filter usually identifies URLs based on predefined patterns, which often includehttp://orhttps://prefixes of protocols, as well aswww.or.com/.cnTop-level domain suffixes. Bare IP addresses do not conform to these typical domain structure characteristics, therefore the filter may not recognize them as clickable links.Ask: If I am sure to display the IP address as a link, is there any other method besides manually adding
<a>tags?Answer: In the AnQiCMS template system, manually add for specific link formats that the filter does not automatically recognize<a>The tag is the most direct and reliable method. For highly repetitive and fixed-format IP links, you can consider preprocessing through other text replacement tools or scripts before content publication, or using more complex regular expression matching in templates.replaceThe filter attempts to implement, but this goes beyondurlizethe scope of filter design and should be tested carefully.Question:
urlizeThe filter will automatically add to all converted linksrel="nofollow"Do properties? Will it affect SEO?Answer: Yes,urlizeThe filter will automatically add to all the links it identifies and convertsrel="nofollow"The attribute tells the search engine not to follow these links and not to pass PageRank.This is usually used for user-generated content (such as comments, forum posts), to prevent spam links and control the weight of external links on the website.It is not recommended to use important links within your websiteurlizeFilter, and should manually create links to ensure that search engines can normally crawl and pass on weight.