Template:U/doc: Difference between revisions
More actions
m +parm |
No edit summary |
||
| (33 intermediate revisions by 8 users not shown) | |||
| Line 1: | Line 1: | ||
{{#ifeq:{{SUBJECTPAGENAME}}|{{SUBJECTSPACE}}:{{BASEPAGENAME}}|{{Heavily used template}} | |||
|{{#ifeq:{{PAGENAME}}|U/main|{{Mbox | |||
|text = The {{T0|U/main|+|case=l}} is a version of {{T0|U|+|case=l}}, with simplified code and two additional possible parameters to modify the link target: the namespace can be changed from "User:" to e.g. "User{{color|b|bg=#BFF|{{0}}talk}}:", and the username can be postfixed with e.g. "{{color|b|bg=#BFF|~commonswiki}}".<br> | |||
With these possibilities the functionality of the templates {{T0|Ut}} resp. {{T0|Uw}} or {{T0|Uwt}} can be performed. | |||
|type = message}} | |||
}}}} | |||
{{TemplateBox | {{TemplateBox | ||
|1=1 | |1=1 | ||
|1d= | | 1label-en = Username | ||
|1def= | | 1d-en = <nowiki/> | ||
|1stat= | It is recommended to define the user name. | ||
<small>If absent, the name is shown of the last editing user</small> | |||
<nowiki/> | |||
| 1d-td-en = It is recommended to define the user name. | |||
| 1default = {{magic word|REVISIONUSER|code=1|nowrap=1}} | |||
| 1def-td = <nowiki>{{REVISIONUSER}}</nowiki> | |||
| 1stat = suggested | |||
| 1type = wiki-user-name | |||
|2=2 | |2=2 | ||
|2d= | | 2label-en = Displayed text | ||
|2def= | | 2d-en = May be formatted wikitext or html. | ||
|2stat= | | 2def = <nowiki>{{{1}}}</nowiki> | ||
| 2stat = optional- | |||
| 2type = line | |||
|3=3 | |3=3 | ||
|3d=language code: for interwiki link. <small>If absent, link to user entry in the Commons</small> | | 3label-en = Interwiki prefix | ||
|3def= | | 3d-en = language code: for interwiki link. <small>If absent, link to user entry in the Commons</small> | ||
|3stat=optional- | | 3d-td-en = Language code for an interwiki link. If absent, link to user entry in the Commons. | ||
| 3def = | |||
| 3stat = optional- | |||
|4=4 | |4=4 | ||
|4d=< | | 4d-en = <nowiki/> | ||
:'''+''' ("plus" sign) to make < | ± ("+" or "-" sign) to precede the user name with the namespace <code>{{ns:2}}:</code> | ||
:'''-''' ("minus" sign) to precede < | |||
The +/- parameter can as well be specified with parameter 2 or 3 --> | :'''+''' ("plus" sign) to make <code>{{ns:2}}:</code> a part of the link | ||
| | :'''-''' ("minus" sign) to precede <code>{{ns:2}}:</code> as plain text | ||
|4stat=optional- | |||
(if ''both'' signs are specified, "+" is used and "-" is ignored)<br> | |||
The +/- parameter can as well be specified with parameter 2 or 3. | |||
<nowiki/> | |||
| 4d-td-en = <nowiki/> | |||
+ or - to precede the user name with the namespace prefix “{{ns:2}}:” | |||
;+ ("plus" sign) | |||
: make “{{ns:2}}:” a part of the link. | |||
;- ("minus" sign) | |||
: precede “{{ns:2}}:” as plain text. | |||
(if both signs are specified, "+" is used and "-" is ignored) | |||
The +/- parameter can as well be specified with parameter 2 or 3. | |||
<nowiki/> | |||
| 4sv = +/- | |||
| 4stat = optional- | |||
| 4type = string | |||
|5=link | |||
| 5d-en = specify <code>link=no</code> to suppress the link | |||
| 5d-td-en = specify “link=no” to suppress the link | |||
| 5av = no | |||
| 5stat = optional- | |||
| 5type = string | |||
|6=<nowiki/> | |||
|6d-td=<nowiki/> | |||
|6d=<br>''more parameters to format the namespace (when "+" or "-" is specified)'' | |||
: <small>» not every possible combination of parameter values is useful «</small> | |||
<nowiki/> | |||
|6def=<nowiki/> | |||
|6def-td= | |||
|6stat=optional- | |||
|name=U | |7=case | ||
|desc=Link to a user, either internal or interwiki | |7d=for formatting of the namespace: | ||
*For users ''without a user page'' you may link to their talk page with {{Tl|Ut}}. | * <code>case=l</code> display "{{lcfirst:{{ns:2}}}}" instead of "{{ns:2}}" | ||
*For links to users of the {{Wd||German}} Wikipedia | * <code>case=i</code> display the national translation, in general a link | ||
* <code>case=n</code> display the national translation without linking it | |||
<nowiki/> | |||
| 7sv = l/i/n | |||
| 7stat = optional- | |||
| 7type = string | |||
|8=i18n | |||
| 8d = An {{W|ISO 630-1|ISO 639}} language code, to follow another translation then yours | |||
: when parameter setting is <code>case=i</code> or <code>case=n</code> | |||
<nowiki/> | |||
| 8def = {{int:lang}} | |||
| 8stat = optional- | |||
| 8type = string | |||
|9 ={{#ifeq:{{PAGENAME}}|U/main|par1}} | |||
|9d ={{#ifeq:{{PAGENAME}}|U/main|Prefix, e.g. <code>talk</code> }} | |||
|9stat ={{#ifeq:{{PAGENAME}}|U/main|optional-}} | |||
|10 ={{#ifeq:{{PAGENAME}}|U/main|par2}} | |||
|10d ={{#ifeq:{{PAGENAME}}|U/main|Postfix, e.g. <code>~commonswiki</code> }} | |||
|10stat={{#ifeq:{{PAGENAME}}|U/main|optional-}} | |||
|name=<includeonly>{{PAGENAME}}</includeonly><noinclude>U</noinclude> | |||
| desc-td = Link to a user, either internal or interwiki. | |||
| desc-en = Link to a user, either internal or interwiki | |||
*{{nobold|For users ''without a user page'' you may link to their talk page with {{Tl|Ut}}.}} | |||
*{{nobold|For links to users of the {{Wd||German}} Wikipedia, use {{Tl|Ud}}.}} | |||
|namespace=all | |namespace=all | ||
|usergroup=all | |usergroup=all | ||
|placement= | |placement= | ||
|usage-notes=Many | |usage-notes=Many users have only a ''User Talk page'' but no ''User page'' on Commons. This results in a ''red link'' with the standard linking <code><nowiki>[[User:UserName]]</nowiki></code>.<br> | ||
An easy edit to fix this link is to | An easy edit to fix this link is just to change the <code><nowiki>{{U|</nowiki></code> to <code><nowiki>{{Ut|</nowiki></code> to link the ''user talk page'' with the user name. | ||
Another reason for a redlink may result of ''changing the user name'' by the postfix "~commonswiki".<br> | Another reason for a redlink may result of ''changing the user name'' by the postfix "~commonswiki".<br> | ||
An easy edit to fix this link is to | An easy edit to fix this link is just to change it to <code><nowiki>{{Uw|</nowiki></code> to link the new user page with the user name,<br>or to the talk page with <code><nowiki>{{Uwt|</nowiki></code> when only this one exists. | ||
Sometimes neither user page nor the user talk page exist on Commons. | Sometimes neither user page nor the user talk page exist on Commons. | ||
* The {{T0|Uc|-}} checks whether the user page exists, and links to it if ''yes''. | |||
::Otherwise it checks whether the user talk page exists, and links to it if ''yes''. | :: Otherwise it checks whether the user talk page exists, and links to it if ''yes''. | ||
:::Otherwise it links to the special page "user contributions" that lists the editor's contributions on Commons. | ::: Otherwise it checks whether a user~commonswiki page exists, and links to it if ''yes''.. | ||
:If the other pages are created later, it automatically prefers the talk page over the user page. | :::: Otherwise it checks whether a user~commonswiki talk page exists, and links to it if ''yes''.. | ||
:<small>Since existence checks are not possible in other Wikipedias, these checks are performed only when ''no language code'' is specified.</small> | ::::: Otherwise it links to the special page "user contributions" that lists the editor's contributions on Commons. | ||
: If the other pages are created later, it automatically prefers the talk page over the user page. | |||
: <small>Since existence checks are not possible in other Wikipedias, these checks are performed only when ''no language code'' is specified.</small> | |||
This template pings the mentioned user like a normal page link. To not ping the user, see {{tl|noping}}. | |||
|seealso= | |seealso= | ||
|setscats= | |setscats= | ||
|example= | |||
|type=linktemp | |||
|lines= | |lines= | ||
|shorthand= | |shorthand= | ||
|relieson= | |relieson={{#switch:{{PAGENAME}}|U/main=|Main template code {{T2|U/main}}}} | ||
== Examples == | |||
Instead of <nowiki>[[User:Konstantinopoulosstephanopoulos|Konstantinopoulosstephanopoulos]]</nowiki><br> | |||
write just <nowiki>{{U|Konstantinopoulosstephanopoulos}}</nowiki> {{0}}for the same output {{U|Konstantinopoulosstephanopoulos}} | |||
Instead of <nowiki>[[User:Renamed user wfoeefkqoifeqofmcqm|Renamed user wfoeefkqoifeqofmcqm]]</nowiki><br> | |||
write just <nowiki>{{U|Renamed user wfoeefkqoifeqofmcqm}}</nowiki> {{0}}for the same output {{U|Renamed user wfoeefkqoifeqofmcqm}} | |||
A matter of {{U|W}}{{U|e}}{{U|i}}{{U|r}}{{U|d}} {{U|g}}{{U|a}}{{U|r}}{{U|b}}{{U|a}}{{U|g}}{{U|e}}. | |||
|i18n-method = - | |i18n-method = - | ||
}} | |i18n-desc=The template does not generate any localizable text; | ||
with + or - always the ''namespace'' in English: "{{ns:2}}" is displayed; only in <br> | |||
combination with <code>case=i</code> or <code>case=n</code> the namespace can be translated using the "{{T2|i18n/namespace|LangSwitch}}" construct (according to <code>lang</code>).<small>{{Lua|Module:LangSwitch}}</small> | |||
{{namespace/display|t=<includeonly>{{PAGENAME}}</includeonly><noinclude>U</noinclude>|name=username | |||
|par1={{#switch:{{PAGENAME}}|Ut|Uwt= talk}}|par2={{#switch:{{PAGENAME}}|Uw|Uwt=~commonswiki}}}} | |||
| useTemplateData = 1 | |||
}}{{clr}} | |||
<span style="float:right" class="editsection"><nowiki>[</nowiki>{{Edit-int|Commons:Link templates/User and user talk links}} <!-- user links --><nowiki>]</nowiki></span> | |||
{{Commons:Link templates/User and user talk links}} | {{Commons:Link templates/User and user talk links}} | ||
| Line 53: | Line 155: | ||
[[Category:Username internal link templates|{{PAGENAME}}]] | [[Category:Username internal link templates|{{PAGENAME}}]] | ||
[[Category:Interwiki link templates|{{PAGENAME}}]] | [[Category:Interwiki link templates|{{PAGENAME}}]] | ||
{{#ifeq:{{PAGENAME}}|U|[[Category:One-letter templates| ]]}} | |||
</includeonly> | </includeonly> | ||
Latest revision as of 02:56, 20 May 2026
Link to a user, either internal or interwiki
Usage
{{U |1= |9= |10= }}
Many users have only a User Talk page but no User page on Commons. This results in a red link with the standard linking [[User:UserName]].
An easy edit to fix this link is just to change the {{U| to {{Ut| to link the user talk page with the user name.
Another reason for a redlink may result of changing the user name by the postfix "~commonswiki".
An easy edit to fix this link is just to change it to {{Uw| to link the new user page with the user name,
or to the talk page with {{Uwt| when only this one exists.
Sometimes neither user page nor the user talk page exist on Commons.
- The Template:Uc checks whether the user page exists, and links to it if yes.
- Otherwise it checks whether the user talk page exists, and links to it if yes.
- Otherwise it checks whether a user~commonswiki page exists, and links to it if yes..
- Otherwise it checks whether a user~commonswiki talk page exists, and links to it if yes..
- Otherwise it links to the special page "user contributions" that lists the editor's contributions on Commons.
- Otherwise it checks whether a user~commonswiki talk page exists, and links to it if yes..
- Otherwise it checks whether a user~commonswiki page exists, and links to it if yes..
- Otherwise it checks whether the user talk page exists, and links to it if yes.
- If the other pages are created later, it automatically prefers the talk page over the user page.
- Since existence checks are not possible in other Wikipedias, these checks are performed only when no language code is specified.
This template pings the mentioned user like a normal page link. To not ping the user, see {{Noping}}.
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
1 | Username |
It is recommended to define the user name. If absent, the name is shown of the last editing user | {{REVISIONUSER}} | suggested |
2 | Displayed text | May be formatted wikitext or html. | {{{1}}} | optional |
3 | Interwiki prefix | language code: for interwiki link. If absent, link to user entry in the Commons | empty | optional |
4 |
± ("+" or "-" sign) to precede the user name with the namespace
(if both signs are specified, "+" is used and "-" is ignored) | empty | optional | |
link | specify link=no to suppress the link | empty | optional | |
| more parameters to format the namespace (when "+" or "-" is specified)
| optional | ||
case | for formatting of the namespace:
| empty | optional | |
i18n | An ISO 639 language code, to follow another translation then yours
| en | optional | |
9 | empty | optional | ||
10 | empty | optional | ||
|
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard. Existing template documentation Newly created template documentation and imports Wikipedia's help about TemplateData • Commons-specific information Link to a user, either internal or interwiki.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
Additional information
The template is intended to be used in the following namespaces: all namespaces
The template is intended to be used by the following user groups: all users
Relies on:
Main template code {{U/main}}
Examples
Instead of [[User:Konstantinopoulosstephanopoulos|Konstantinopoulosstephanopoulos]]
write just {{U|Konstantinopoulosstephanopoulos}} for the same output Konstantinopoulosstephanopoulos
Instead of [[User:Renamed user wfoeefkqoifeqofmcqm|Renamed user wfoeefkqoifeqofmcqm]]
write just {{U|Renamed user wfoeefkqoifeqofmcqm}} for the same output Renamed user wfoeefkqoifeqofmcqm
Localization
This template is not intended to be localized.
The template does not generate any localizable text;
with + or - always the namespace in English: "User" is displayed; only in
case=i or case=n the namespace can be translated using the "{{LangSwitch}}" construct (according to lang).
| Table: different displays for {{U}} with the namespace option | |
|---|---|
| {{ U | username }} this is the standard | username |
| {{ U | username | - }} | User:username |
| {{ U | username | - | case = l }} | user:username |
| {{ U | username | - | case = i }} | user:username |
| {{ U | username | - | case = n }} | user:username |
| {{ U | username | + }} | User:username |
| {{ U | username | + | case = l }} | user:username |
| {{ U | username | + | case = i }} | user:username |
| {{ U | username | + | case = n }} | user:username |
| {{ U | username | link = n }} | username |
| {{ U | username | - | link = n }} | User:username |
| {{ U | username | - | link = n | case = l }} | user:username |
| {{ U | username | - | link = n | case = i }} | user:username |
| {{ U | username | - | link = n | case = n }} | user:username |
| {{ U | username | + | link = n }} | User:username |
| {{ U | username | + | link = n | case = l }} | user:username |
| {{ U | username | + | link = n | case = i }} | user:username |
| {{ U | username | + | link = n | case = n }} | user:username |
[ ] {{Commons:Link templates/User and user talk links}}