Editing
Template:URL/doc
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
The edit appears to have already been undone.
Anti-spam check. Do
not
fill this in!
{{Documentation subpage}} {{lua|Module:URL}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> This template can be used to create a formatted external link. It formats the appearance of '''''displayed''''' URLs, while making them ''machine-readable'' as part of emitted [[w:microformat|microformat]] meta-data, inside templates such as infoboxes. If you wish to display text instead of the URL (e.g. "[http://example.com website]" instead of {{URL|example.com}}), please '''do not use this template'''. Instead, consider using normal [[w:m:Help:Link#External_links|wiki markup]], [[Template:Plain link]], or [[Template:Official website]]. Displaying text instead of the url will render the microformat data invalid. For web-based references, please see [[w:Wikipedia:Citation templates]]'' == Usage == * <code><nowiki>{{URL|</nowiki>''example.com''<nowiki>}}</nowiki></code> ** The first parameter is parsed to see if it takes the form of a complete URL. If it doesn't start with a URI scheme (such as "http:", "https:", or "ftp:"), an "http://" prefix will be prepended to the specified generated target URL of the link. ** Parameter 2 (<code><nowiki>{{URL|</nowiki>''url name''<nowiki>|</nowiki>''optional display text''<nowiki>}}</nowiki></code>) is '''deprecated'''. See note above for more information and alternative templates. '''Warning:''' The parameter 1 must be numbered explicitly (<code><nowiki>{{URL|</nowiki>1=''example.com''<nowiki>}}</nowiki></code>) if the URL contains an equal sign, as is common in a query string. This applies when the value of the URL is unknown, for example when this template is used in another template specifying the effective URL as a variable value. The ''deprecated'' second parameter for the displayed text, if present in legacy uses, '''must''' also be explicitly numbered if the first parameter is explicitly numbered (<code><nowiki>{{URL|</nowiki>1=''url name''<nowiki>|</nowiki>2=''optional display text''<nowiki>}}</nowiki></code>); otherwise it will override the value of the first parameter. === Examples === {|class="wikitable" |- ! Code !! Result |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| EXAMPLE.com }}</nowiki></code> | {{ {{BASEPAGENAME}} | EXAMPLE.com }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| example.com }}</nowiki></code> | {{ {{BASEPAGENAME}} | example.com }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://example.com }}</nowiki></code> | {{ {{BASEPAGENAME}} | http://example.com }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com }}</nowiki></code> | {{ {{BASEPAGENAME}} | www.example.com }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com }}</nowiki></code> | {{ {{BASEPAGENAME}} | http://www.example.com }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| https://www.example.com }}</nowiki></code> | {{ {{BASEPAGENAME}} | https://www.example.com }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| ftp://www.example.com }}</nowiki></code> | {{ {{BASEPAGENAME}} | ftp://www.example.com }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| ftp://ftp.example.com }}</nowiki></code> | {{ {{BASEPAGENAME}} | ftp://ftp.example.com }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/ }}</nowiki></code> | {{ {{BASEPAGENAME}} | http://www.example.com/ }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/path }}</nowiki></code> | {{ {{BASEPAGENAME}} | http://www.example.com/path }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| irc://irc.example.com/channel }}</nowiki></code> | {{ {{BASEPAGENAME}} | irc://irc.example.com/channel }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com/foo }}</nowiki></code> | {{ {{BASEPAGENAME}} | www.example.com/foo }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/path/ }}</nowiki></code> | {{ {{BASEPAGENAME}} | http://www.example.com/path/ }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com/foo/ }}</nowiki></code> | {{ {{BASEPAGENAME}} | www.example.com/foo/ }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| 1=http://www.example.com/path?section=17 }}</nowiki></code> | {{ {{BASEPAGENAME}} | 1=http://www.example.com/path?section=17 }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| 1=www.example.com/foo?page=42 }}</nowiki></code> | {{ {{BASEPAGENAME}} | 1=www.example.com/foo?page=42 }} |- | <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com | example.com }}</nowiki></code> | {{ {{BASEPAGENAME}} | www.example.com | example.com }} |} == Microformat == The template wraps the ''displayed'' URL with a <code>class="url"</code> so that it is included in any parent [[microformat]] which takes a URL parameter - see [[WP:UF|our microformats project]]. == TemplateData == {{TemplateDataHeader}} <templatedata> { "description": "A template to display and format a URL, inside other tempates", "params": { "1": { "label": "URL", "description": "The URL to be linked", "type": "string", "required": true }, "2": { "label": "Display text", "description": "The text to be displayed instead of the URL. Deprecated", "type": "string", "required": false, "deprecated": true } } } </templatedata> == See also == * {{Tl|Official URL}} * {{Tl|Official website}} * {{Tl|Plain link}} <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | | <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:External link templates]] }}</includeonly>
Summary:
Please note that all contributions to Meta Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Meta Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Dark mode
Contributions
Create account
Log in
Namespaces
Template
Discussion
English
Views
Read
Edit source
View history
More
Purge
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information
Get shortened URL