Help:Pipe trick
From Wikipedia, the free encyclopedia
The pipe trick is a way (or really several ways) to create links without having to type a lot of extra text. The advantage is that you are less likely to make a mistake when you type less. It's also easier for others to edit it. To create the pipe character ("|") press (SHIFT + BACKSLASH ["\"]) on English-layout and some other keyboards. When you place a pipe character ("|") after an article title which ends with a parenthesized term or contains a comma or colon, the wiki software transforms what you entered. The non-parenthesized part of the article title is used as the visible part of the link. This does not work in edit summaries, and in certain other cases (listed below).
Contents |
[edit] Examples
This may be hard to follow, so please see the examples:
| Type this | Generates this when you "Save page" | Appears as |
|---|---|---|
| Article titles | ||
[[g (factor)|]] |
[[g (factor)|g]] |
g |
[[Boston, Massachusetts|]] |
[[Boston, Massachusetts|Boston]] |
Boston |
[[The Lord of the Rings: The Fellowship of the Ring (video game)|]] |
[[The Lord of the Rings: The Fellowship of the Ring (video game)|The Fellowship of the Ring]] |
The Fellowship of the Ring |
| Redirection | ||
[[Bush (43)|]] |
[[Bush (43)|Bush]] |
Bush |
[[Bush (41)|]] |
[[Bush (41)|Bush]] |
Bush |
| Normal titles | ||
[[Wikipedia:Help|]] |
[[Wikipedia:Help|Help]] |
Help |
| Users | ||
[[User:Example|]] |
[[User:Example|Example]] |
Example |
[edit] Where it does not work
[edit] Cite.php <ref> footnotes
The trick does not work when enclosing between "ref" tags. <ref>[[Roger Taylor (author)|]]</ref>[1] renders in the references list (generated by the <references/> tag) as:
- ^ [[Roger Taylor (author)|]]
[edit] Edit summaries
The trick does not work in edit summaries. /* Edit summaries and the pipe trick */ as tested in [[WP:SAND|]] renders in the edit history as:
(→Edit summaries and the pipe trick: as tested in WP:SAND)
[edit] Slash trick
You can achieve the same effect for subpages by adding a slash: [[/subpage/]] generates the same output as [[/subpage|subpage]]. Unlike the pipe trick, though, it will not be transformed in the wikitext.
This trick only works in namespaces where [[/subpage]] would.
[edit] Reverse pipe trick
Typing [[|Agonizer]] on, for example, Agonist (disambiguation) will cause the link to be expanded to [[Agonizer (disambiguation)|Agonizer]]; similarly on a page with a name containing a comma. Using the reverse pipe trick on a page that has no parentheses or comma in its name is unproductive; the pipe character is automatically removed.
[edit] Try it!
The best way to understand this is to try it yourself in the sandbox. Use one of the examples under "Type this" above, save the page, then immediately edit it again. You'll see the transformation, and it should be clearer exactly what happened.

