This template is used on approximately 10,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
Preview message: Transclusion count updated automatically (see documentation). |
This template uses Lua: |
This is a fork of Template:URL for use in infoboxes.
It behaves similarly to {{URL}} with the following exceptions:
{{URL|example.com|optional display text}}
by default.|msg=
that turns on or off the message {{URL|example.com|optional display text}}
. Setting msg to false or anything beginning with n or N will suppress the message. Anything else enables the message.{{URL2}}
in the design of an infobox, without causing problems if editors add |website={{URL|some.url.com}}
in an article.{{URL2|url}}
{{URL2|1=url}}
If there is no input, the default behavior of URL2 is to display nothing (use |msg=
to display the instructional message):
{{URL2| }}
→{{URL2|msg=yes| }}
→ {{URL|example.com|optional display text}}
{{URL2|msg=true| }}
→ {{URL|example.com|optional display text}}
URL2 handles formatting commonly found in the |website=
parameter of an infobox:
{{URL2|[http://www.example.com]}}
→ www{{URL2|http://www.example.com|website}}
→ website{{URL2|{{URL|www.example.com}}}}
→ www{{URL2|{{URL2|www.example.com}}}}
→ wwwThe template wraps the output in <span class="url">...</span>
(see § Microformat) and adds <wbr/> before displayed periods:
{{URL2|www.example.com}}
→ www<span class="url">[http://www.example.com www<wbr/>.example<wbr/>.com]</span>
The use of http://, https://, a protocol-relative URL, or a different protocol is preserved in the URL but is not shown in the link text:
{{URL2|http://www.example.com}}
→ www<span class="url">[http://www.example.com www<wbr/>.example<wbr/>.com]</span>
{{URL2|https://www.example.com}}
→ www<span class="url">[https://www.example.com www<wbr/>.example<wbr/>.com]</span>
{{URL2|//www.example.com}}
→ www<span class="url">[//www.example.com www<wbr/>.example<wbr/>.com]</span>
{{URL2|ftp://ftp.example.com}}
→ ftp<span class="url">[ftp://ftp.example.com ftp<wbr/>.example<wbr/>.com]</span>
If the path is only a slash (/
) it is not displayed in the link text:
{{URL2|https://www.example.com/}}
→ www<span class="url">[https://www.example.com/ www<wbr/>.example<wbr/>.com]</span>
The template also adds <wbr/> before any displayed slashes (/
) in the path:
{{URL2|https://www.example.com/path}}
→ www<span class="url">[https://www.example.com/path www<wbr/>.example<wbr/>.com<wbr/>/path]</span>
For a URL containing an equal sign (=
), use |1=
:
{{URL2|1=http://www.example.com/path?section=17}}
→ www<span class="url">[http://www.example.com/path?section=17 www<wbr/>.example<wbr/>.com<wbr/>/path?section=17]</span>
The template wraps the displayed URL with class="url"
so that it is included in any parent microformat which takes a URL parameter - see Wikipedia:WikiProject Microformats.