Template:Xl/doc
Documentation
This template forms external links.
The name of the template is based on the phrase "external link".
Usage
Some common cases. Other combinations are possible.
{{xl|URL}}{{xl|URL|text to be linked}}{{xl|url=|linktext=}}{{xl|domain=|path=|linktext=}}{{xl|protocol=|domain=|path=|linktext=}}{{xl|url=|linktext=|site=|icon=|accessed=}}{{xl|url=|linktext=|pre=|post=|encl=|open=|close=|site=|icon=|accessed=}}
The full URL can be passed through the first positional parameter or the named parameter url (and this URL must contain the characters // before the domain name, as seen in the examples below). Alternatively, the URL can be split into a protocol, domain, and path using parameters of those names. For example, url=https://www.facebook.com/angelinajordanofficial is equivalent to using protocol=https:, domain=www.facebook.com, and path=angelinajordanofficial (note the colon in the value of protocol!). The protocol can be omitted if the site accepts both HTTP and HTTPS connections. The template defaults to using protocol-relative URLs↗.
If not otherwise specified, the text to be linked defaults to the page name.
All named parameters
{{xl|url=|protocol=|domain=|path=|linktext=|pre=|post=|encl=|open=|close=|site=|icon=|accessed=}}
Note that if url is specified (even if the value is empty), then protocol, domain, and path will not be used.
Examples
{{xl|//example.com/|Example}}⇒ Example↗{{xl|url=//example.com/|linktext=Example}}⇒ Example↗{{xl|//www.youtube.com/watch{{?|v|nwFloCPXzCs}}|I Put a Spell on You|encl="}}⇒ "I Put a Spell on You"↗{{xl|domain=www.amazon.com|path=dp/B08M979389|linktext=Million Miles|encl="|site=Amazon.com|icon={{icon-amz}}|accessed=2020-11-27}}⇒ "Million Miles"↗ a{{xl|//example.com/|Example|pre=[|post=]|encl="|open=«|close=»}}⇒ ["«Example»"]↗
Hover on the north-east pointing arrow to see the effect of the site and accessed parameters. Note in the third example how the {{?}} template is used to form a query srting (although that particular example would be even easier to construct using {{ytv}}).
The last example is just to show the order that pre/post, open/close, and encl are displayed when they are used together.