When the last character of a link is the pipe character, the pipe trick will automatically generate the text that displays for that link. Its processing removes the parenthesized part of the link title, handles commas in the title, and removes 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.
An even better way to save keystrokes that doesn't need any additional characters is by simply attaching text to the link, as in "[[train]]s".
The pipe trick doesn't work in edit summaries, within <ref> tags, or links to sections – see below.
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.
As with all links, it is possible to blend a suffix when using the pipe trick as well:
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:
Where the pipe trick doesn't work, the link must be written out in full manually.
renders in the references list (generated by the <references/> tag) 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,
It does not give you any wikilink. See phabricator:T2845, "[[#foo|]], [[/bar|]] should be equivalent to [[#foo|foo]], [[/bar|bar]]".
Unlike the pipe trick, though, the slash trick is not expanded in the saved wiki markup.
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.
were placed in Agonist (disambiguation), the link would be expanded to
were placed in Pacific Grove, California, 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.