Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Url/doc: Difference between revisions

Template page
m See also: remove link to template that does not exist any more
Fix language-code links to use Wikipedia interwiki prefixes
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
{{High-use|risk}}
This template can be used to create a formatted external link.&nbsp;
This template can be used to create a formatted external link.&nbsp;


== Usage ==
== Usage ==
:* <code><nowiki>{{URL|</nowiki>1=''url name''<nowiki>|</nowiki>2=''optional display text''<nowiki>}}</nowiki></code>
:* <code><nowiki>{{Url|</nowiki>1=''url name''<nowiki>|</nowiki>2=''optional display text''<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 an known URI scheme and a slash ("http:/" or "https:/" or "ftp:/", possibly others in the future, by editing its code), an "http://" prefix will be prepended to the specified generated target URL of the link.
:** The first parameter is parsed to see if it takes the form of a complete URL. If it doesn't start with an known URI scheme and a slash ("http:/" or "https:/" or "ftp:/", possibly others in the future, by editing its code), an "http://" prefix will be prepended to the specified generated target URL of the link.
:** If no display text is specified or is empty, a default display text will be inferred by trying to reduce the specified URL without its recognized URI scheme (and without the common "www." hostname prefix which is assigned in almost all domains as the default one for this domain, and without the default "/" path of HTTP and FTP resources), and the domain name part will be forced to lowercase (for shorter and canonical display, but also to limit the occurrences of easily confusable characters, for example between letters and digits). The rest of the URL (including the rest of its path, the optional query string or the specified anchor) will be displayed unchanged.
:** If no display text is specified or is empty, a default display text will be inferred by trying to reduce the specified URL without its recognized URI scheme (and without the common "www." hostname prefix which is assigned in almost all domains as the default one for this domain, and without the default "/" path of HTTP and FTP resources), and the domain name part will be forced to lowercase (for shorter and canonical display, but also to limit the occurrences of easily confusable characters, for example between letters and digits). The rest of the URL (including the rest of its path, the optional query string or the specified anchor) will be displayed unchanged.
:* <code><nowiki>{{URL|</nowiki>2=''display text''<nowiki>}}</nowiki></code>
:* <code><nowiki>{{Url|</nowiki>2=''display text''<nowiki>}}</nowiki></code>
:** The url or domain name is optional : if it is not specified in the first parameter or this parameter is empty, the display text becomes mandatory, and will be displayed without any change.
:** The url or domain name is optional : if it is not specified in the first parameter or this parameter is empty, the display text becomes mandatory, and will be displayed without any change.
:** If both parameters are missing or empty, a default message referencing a correct usage of this template will be generated (including a link to this page), to help editors.
:** If both parameters are missing or empty, a default message referencing a correct usage of this template will be generated (including a link to this page), to help editors.
Line 21: Line 21:
! Code !! Result
! Code !! Result
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki> }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki> }}</nowiki></code>
| {{ {{BASEPAGENAME}} }}  
| {{ {{BASEPAGENAME}} }}  
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| }}</nowiki></code>
| {{ {{BASEPAGENAME}} | }}  
| {{ {{BASEPAGENAME}} | }}  
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| EXAMPLE.com }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| EXAMPLE.com }}</nowiki></code>
| {{ {{BASEPAGENAME}} | EXAMPLE.com }}  
| {{ {{BASEPAGENAME}} | EXAMPLE.com }}  
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| example.com }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| example.com }}</nowiki></code>
| {{ {{BASEPAGENAME}} | example.com }}  
| {{ {{BASEPAGENAME}} | example.com }}  
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com }}</nowiki></code>
| {{ {{BASEPAGENAME}} | www.example.com }}
| {{ {{BASEPAGENAME}} | www.example.com }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com }}</nowiki></code>
| {{ {{BASEPAGENAME}} | http://www.example.com }}
| {{ {{BASEPAGENAME}} | http://www.example.com }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| https://www.example.com }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| https://www.example.com }}</nowiki></code>
| {{ {{BASEPAGENAME}} | https://www.example.com }}
| {{ {{BASEPAGENAME}} | https://www.example.com }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| ftp://www.example.com }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| ftp://www.example.com }}</nowiki></code>
| {{ {{BASEPAGENAME}} | ftp://www.example.com }}
| {{ {{BASEPAGENAME}} | ftp://www.example.com }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| ftp://ftp.example.com }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| ftp://ftp.example.com }}</nowiki></code>
| {{ {{BASEPAGENAME}} | ftp://ftp.example.com }}
| {{ {{BASEPAGENAME}} | ftp://ftp.example.com }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/ }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/ }}</nowiki></code>
| {{ {{BASEPAGENAME}} | http://www.example.com/ }}
| {{ {{BASEPAGENAME}} | http://www.example.com/ }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/path }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/path }}</nowiki></code>
| {{ {{BASEPAGENAME}} | http://www.example.com/path }}
| {{ {{BASEPAGENAME}} | http://www.example.com/path }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com/foo }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com/foo }}</nowiki></code>
| {{ {{BASEPAGENAME}} | www.example.com/foo }}
| {{ {{BASEPAGENAME}} | www.example.com/foo }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/foo | link }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/foo | link }}</nowiki></code>
| {{ {{BASEPAGENAME}} | http://www.example.com/foo | link }}
| {{ {{BASEPAGENAME}} | http://www.example.com/foo | link }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com/foo | link }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com/foo | link }}</nowiki></code>
| {{ {{BASEPAGENAME}} | www.example.com/foo | link}}
| {{ {{BASEPAGENAME}} | www.example.com/foo | link}}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/path/ }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/path/ }}</nowiki></code>
| {{ {{BASEPAGENAME}} | http://www.example.com/path/ }}
| {{ {{BASEPAGENAME}} | http://www.example.com/path/ }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com/foo/ }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com/foo/ }}</nowiki></code>
| {{ {{BASEPAGENAME}} | www.example.com/foo/ }}
| {{ {{BASEPAGENAME}} | www.example.com/foo/ }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/foo/ | link }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| http://www.example.com/foo/ | link }}</nowiki></code>
| {{ {{BASEPAGENAME}} | http://www.example.com/foo/ | link }}
| {{ {{BASEPAGENAME}} | http://www.example.com/foo/ | link }}
|-
|-
| <tt><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com/foo/ | link }}</nowiki></tt>
| <code><nowiki>{{</nowiki> {{BASEPAGENAME}} <nowiki>| www.example.com/foo/ | link }}</nowiki></code>
| {{ {{BASEPAGENAME}} | www.example.com/foo/ | link}}
| {{ {{BASEPAGENAME}} | www.example.com/foo/ | link}}
|}
|}


== Microformat==
== 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]].
The template wraps the displayed URL with a <code>class="url"</code> so that it is included in any parent [[w:microformat|microformat]] which takes a URL parameter - see [[w:WP:UF|our microformats project]].
 
 


<includeonly>
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Text formatting templates]]
[[Category:Text formatting templates]]
[[ar:قالب:URL]]
[[cy:Nodyn:URL]]
[[gu:ઢાંચો:URL]]
[[ja:Template:URL]]
[[lv:Veidne:URL]]
[[mk:Шаблон:URL]]
[[ru:Шаблон:URL]]
[[ur:Template:URL]]
</includeonly>
</includeonly>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.