Help:Pipe trick

All you want to know about Help:Pipe trick

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

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

Cite.php footnotes and the pipe trick

The pipe trick auto-converts, for example, [[Roger Taylor (author)|]] to [[Roger Taylor (author)|Roger Taylor]]

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:

  1. ^ [[Roger Taylor (author)|]]

Edit summaries and the pipe trick

The pipe trick auto-converts, for example, [[WP:SAND|]] to SAND

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)

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.

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.

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.

See also


No comments have been added.



Your name:

City:

Country:

Your comments:

Security check *
(Please enter the number into adjoining box)

 
  • Ads

           
eXTReMe Tracker