The pipe trick uses the pipe character ("
[[File:Redirect arrow without text.svg|46px|#REDIRECT|link=]]<span class="redirectText" id="softredirect">[[:mw:Help:Magic words#Other|mw:Help:Magic words#Other]]</span><br /><span style="font-size:85%; padding-left:48px;">This page is a [[Wikipedia:Soft redirect|soft redirect]].</span>[[Category:Wikipedia soft redirected project pages|Pipe trick]]") to save typing the label of a piped link for several kinds of wiki links. This can avoid potentially making an error while typing the label.
When the last character of a link is the pipe character, the pipe trick will automatically generate the text that displays for that link. It removes the parenthesized part of the link title, but it also processes commas in the title, and namespace prefixes. The described processing happens at the point of saving the page data, and the generated text is saved with the rest of the page's wiki markup – thus, it is merely an aid to editing.
The pipe trick doesn't work in edit summaries, within <ref> tags, or links to sections – see below.
- 1 Examples
- 2 Combinations
- 3 Where it doesn't work
- 4 Related tricks
- 5 Alternatives
- 6 See also
Pages in other namespaces
The next few examples demonstrate additional features and show the expanded wiki markup text that this pipe-trick process generates, which in turn generates the results in the page display.
Since Wikipedia is case-insensitive in regard to the first character of the target title, it is possible to use the pipe trick for upper- or lowercase words regardless of the target page's case.
[[Pipe (computing)|]]generates the wiki markup
[[Pipe (computing)|Pipe]]rendered as Pipe
[[pipe (computing)|]]generates the wiki markup
[[pipe (computing)|pipe]]rendered as pipe
As with all links, it is possible to blend an affix when using the pipe trick as well:
[[pipe (computing)|]]sgenerates the wiki markup
[[pipe (computing)|pipe]]srendered as pipes
[[pipe (computing)|]]millgenerates the wiki markup
[[pipe (computing)|pipe]]millrendered as pipemill
The basic rule when the pipe trick is used is that an (initial) namespace prefix, a final part beginning with a comma, or a final parenthesis (usually intended for disambiguation) is suppressed in the rendering of the link. The rendered text is case neutral and so should be entered precisely as the user wishes it to appear in the article. In case of combinations of suppressible parts, the following rules apply:
Commas beat parentheses
If the link name involves both one or more commas and a final parenthesis, only the parenthesis is suppressed:
is shown on the page as:
Only one prefix suppressed
If there are several prefixes, which can occur, for example, for an interlanguage link, only the first is suppressed:
is rendered as:
Only the first comma
If there are several commas, only the part up to the first comma is shown:
For the rest, if there is both an initial part and a final part that can be omitted, both are suppressed:
Where it doesn't work
Where the pipe trick doesn't work, the link must be written out in full manually.
|40x40px||This was reported as a bug over 10 years ago, but as of 7 February 2015[update] it has not been resolved. See this bug report for technical details.|
<ref>[[Roger Taylor (author)|]]</ref>
renders in the references list (generated by the <references/> tag) as:
- [[Roger Taylor (author)|]]
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:
The pipe trick does not work on section links, and in general it does not work for links to anchors (links that use a
# sign). For example,
does not give you any wikilink. See Bugzilla:845, "[[#foo|]], [[/bar|]] should be equivalent to [[#foo|foo]], [[/bar|bar]]".
You can achieve a similar effect for subpages by adding a slash.
Unlike the pipe trick, though, the slash trick is not expanded in the saved wiki markup.
This trick only works in namespaces where subpages are enabled.
Reverse pipe trick
If the title of the article you are editing includes a parenthesized term or a comma, placing a pipe at the start of a link will append that parenthesized text to the link target, but not display it.
For example, if the link
were placed in Agonist (disambiguation), the link would be expanded to
Placing a pipe at the start of a link to an article that has no parentheses or comma in its title will have no effect.
Some templates are available as alternatives to using the trick for linking.