Template:URL2
Script error: No such module "URL".
| This template uses Lua: |
This is a fork of Template:URL for use in infoboxes.
It behaves similarly to {{URL}} with the following exceptions:
- By default it does not display anything if the parameters are blank or omitted. Template:URL displays Script error: No such module "URL". by default.
- It implements a parameter
|msg=that turns on or off the message Script error: No such module "URL".. Setting msg to false or anything beginning with n or N will suppress the message. Anything else enables the message. - It strips html tags and wiki-link markup from the supplied url parameter.
- It truncates the url parameter at the first space it finds.
- It can take its own output as input, allowing website parameters to be wrapped in Script error: No such module "URL". in the design of an infobox, without causing problems if editors add
|website={{URL|some.url.com}}in an article.
Contents
Usage
{{URL2|url}}{{URL2|1=url}}
Examples
Different from Template:URL
If there is no input, the default behavior of URL2 is to display nothing (use |msg= to display the instructional message):
{{URL2| }}→ Script error: No such module "URL".
{{URL2|msg=yes| }}→ Script error: No such module "URL".
{{URL2|msg=true| }}→ Script error: No such module "URL".
URL2 handles formatting commonly found in the |website= parameter of an infobox:
{{URL2|[http://www.example.com]}}→ Script error: No such module "URL".
{{URL2|http://www.example.com|website}}→ Script error: No such module "URL".
{{URL2|{{URL|www.example.com}}}}→ Script error: No such module "URL".
{{URL2|{{URL2|www.example.com}}}}→ Script error: No such module "URL".
Same as Template:URL
The template wraps the output in <span class="url">...</span> (see Script error: No such module "Section link".) and adds <wbr/> before displayed periods:
{{URL2|www.example.com}}→ Script error: No such module "URL".<strong class="error"><span class="scribunto-error" id="mw-scribunto-error-12">Script error: No such module "URL".</span></strong>
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}}→ Script error: No such module "URL".<strong class="error"><span class="scribunto-error" id="mw-scribunto-error-13">Script error: No such module "URL".</span></strong>
{{URL2|https://www.example.com}}→ Script error: No such module "URL".<strong class="error"><span class="scribunto-error" id="mw-scribunto-error-14">Script error: No such module "URL".</span></strong>
{{URL2|//www.example.com}}→ Script error: No such module "URL".<strong class="error"><span class="scribunto-error" id="mw-scribunto-error-15">Script error: No such module "URL".</span></strong>
{{URL2|ftp://ftp.example.com}}→ Script error: No such module "URL".<strong class="error"><span class="scribunto-error" id="mw-scribunto-error-16">Script error: No such module "URL".</span></strong>
If the path is only a slash (/) it is not displayed in the link text:
{{URL2|https://www.example.com/}}→ Script error: No such module "URL".<strong class="error"><span class="scribunto-error" id="mw-scribunto-error-17">Script error: No such module "URL".</span></strong>
The template also adds <wbr/> before any displayed slashes (/) in the path:
{{URL2|https://www.example.com/path}}→ Script error: No such module "URL".<strong class="error"><span class="scribunto-error" id="mw-scribunto-error-18">Script error: No such module "URL".</span></strong>
For a URL containing an equal sign (=), use |1=:
{{URL2|1=http://www.example.com/path?section=17}}→ Script error: No such module "URL".<strong class="error"><span class="scribunto-error" id="mw-scribunto-error-19">Script error: No such module "URL".</span></strong>
Microformat
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.
See also
- {{URL}}
- {{#invoke:WikidataIB|url2}}
- {{Official URL}}
- {{Official website}}
| The above documentation is transcluded from Template:URL2/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |