By adding a pipe or vertical bar ("|" --
Shift + Backslash on most keyboards) before the closing brackets in certain links, you can hide:
- namespaces and other prefixes that use commas
- clarifying words in parentheses
- words after commas
This is a variation on the original use of the pipe by which you type the desired display after the pipe.
The pipe trick is helpful for when you want to link to a page from within a sentence without using the full page name. It affects only what is displayed on the page, not where the link goes. After you save the page, the software adds the displayed text to the code.
Since the pipe trick can be hard to follow, it is best illustrated through the following examples:
Namespace or other prefix that precedes a colon
Everything up to the (first) colon is hidden:
[[Project:Something|]]is converted to
[[w:Category:Something|]]is converted to
- User:Example would be converted to Example.
- w:Category:Policy would be converted to Category:Policy.
Bracket and what follows
[[Someone (author)|]]is converted to
[[Someone (clown)|]]is converted to
Comma and what follows
[[Some City, Some State|]]is converted to
[[Some City, Some State|Some City]].
A prefix will be hidden in addition to a comma or bracket expression.
Parentheses take precedence over commas: where a link has a comma (or more than one) and a final parenthesis, only the parenthesis disappears:
- [[Category:Yours, Mine and Ours (1968 film)|]] becomes [[Yours, Mine and Ours (1968 film)|Yours, Mine and Ours]]
- The pipe trick does not work for external links; the equivalent code, a space, must have the desired display typed or pasted after it.
- It does not work in: section links; edit summaries; references defined by "ref" tags.
- Pipes work differently with categories, defining the listing order.