User:Wlgrin/Sandbox/Generic/Main/Template001/doc
The User Space template ({{US}}
) is used to help transclude user pages (typically, user templates) within other user pages belonging to the same user. As a safeguard, its behaviour depends on whether the transcluding page is itself within user space (as expected) or not, thereby avoiding the inadvertent transclusion of pages from user space into Wikipedia articles or project pages.
Using this template, one may replace calls such as
{{User:MeMyselfEtMoi/Template/MyTemplate|Parameter value}}
with the relatively simpler
{{{{US|MyTemplate}}|Parameter value}}
This template only expands the name of the transcluded page, so the whole call (and any parameter that may follow) must be nested within another double pair of braces.
If the transcluding page is in the User or User talk namespace, the template called through {{US}}
will be found in a sub-page of “User:user-name/Template/” (where user-name is derived from the name of the transcluding page). If the transcluding page is in any other namespace, the template is found normally (by default, in namespace Template).
- For example, if the transcluding page is “User:MeMyselfEtMoi/My current projects”, using
{{{{US|My template}}|Parameter value}}
- will produce
{{User:MeMyselfEtMoi/Template/My template|Parameter value}}
- If this same call was inadvertently copied into an article (out of user space), it would instead expand to
{{My template|Parameter value}}
If the template name (passed as first argument to {{US}}
) begins with a “/” and the transcluding page is in user space, the template is searched in a sub-page of “User:user-name” (instead of “User:user-name/Template/”).
- For example,
{{{{US|/Sandbox/My new template}}|Parameter value}}
- will produce
{{User:MeMyselfEtMoi/Sandbox/My new template|Parameter value}}
- Again, if this same call was inadvertently copied into an article (out of user space), it would instead expand to
{{Sandbox/My new template|Parameter value}}
If you do not need to pass any parameter, remember to separate the two closing sets of double braces; otherwise, the closing series of four braces will confuse the MediaWiki parser. You can use, for example, a space or a pipe. Using a pipe will cause an empty unnamed parameter to be passed to the template, which is generally without adverse consequences (but check the syntax of the called template to confirm this).
- For example, this incorrect call:
{{{{US|My template}}}}
- will produce the likely unwanted output
{My template}
- By contrast,
{{{{US|My template}} }}
- will produce, as desired,
{{User:MeMyselfEtMoi/Template/My template}}
- Similarly, using a pipe,
{{{{US|My template}}|}}
- will produce
{{User:MeMyselfEtMoi/Template/My template|}}