Help:Pipe trick

From Wikipedia, the free encyclopedia
Jump to: navigation, search

The pipe trick uses the pipe character ("|") to save typing the label of a piped link for several kinds of wiki links. This can help avoid 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 any part of the link title that is inside parentheses, but it also processes commas in the title, and namespace prefixes (e.g., "Help:"). The generated text is saved with the rest of the page's wiki markup.

The pipe trick does not work in change summaries, within <ref> tags, or links to sections – see below.

Examples[change | change source]

Article titles
  • [[Character (computing)|]] generates Character
  • [[Boston, Massachusetts|]] generates Boston
Pages in other namespaces
Combinations

If the link name involves both one or more commas and a final parenthesis, only the parenthesis is suppressed:

  • [[Pinocchio (1940 movie)|]] is shown on the page as Pinocchio

If there are several prefixes, which can occur, for example, for an interlanguage link, only the first is suppressed:

If there are several commas, only the part up to the first comma is shown:

  • [[Il Buono, il Brutto, il Cattivo|]] results in Il Buono

For the rest, if there is both an initial part and a final part that can be omitted, both are suppressed:

  • [[Wikipedia:Notability (music)|]] produces Notability

Where it doesn't work[change | change source]

In some cases, the pipe trick does not work, and the link must be written out in full manually. The trick does not work when enclosing between <ref></ref> tags or <gallery></gallery> tags. It also does not work in change summaries.

The pipe trick does not work with section links, and in general it does not work for links to anchors (links that use a # sign). For example, [[Wikipedia:Verifiability#Sources|]] does not give you any wikilink.

Related tricks[change | change source]

Slash trick

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 term in parentheses or a comma, placing a pipe at the start of a link will add that text to the end of the link target, but not display it.

For example, if the link [[|Brush]] were placed in Broom (disambiguation), the link would be expanded to [[Brush (disambiguation)|Brush]]

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.

Related pages[change | change source]