This help page is a how-to guide. It explains concepts or processes used by the Wikipedia community. It is not one of Wikipedia's policies or guidelines, and may reflect varying levels of consensus. |
| Linking and page manipulation |
|---|
A piped link is an internal link that displays text different from the title of the page to which the text links. It is created with wikitext (markup code) that results in hyperlinked (underlined, clickable) text. It is called "piped" because it uses the pipe character ("|") or vertical bar.
For example, the wikitext [[train station|station]] displays as station but it links to the Wikipedia article about train stations.
Do not confuse piped links and redirects: they are two very different mechanisms. Both allow the displayed text of a link to differ from the title of the final destination page (the page that a reader will see after clicking that link). However, a piped link conceals the destination page's title only in that single line on the single page where its wikitext is used, while on any page throughout Wikipedia any link, piped or not, to a specific redirect page will always lead to the same destination page.
Use
[edit]Piped links are useful for preserving the grammatical structure and flow of a sentence when:
- the wording of the exact link title does not fit in context (see here for an example, which uses the wording and syntax of
cetaceans have been extensively [[hunt]]ed by [[humans]] for their [[whale meat|meat]], [[blubber]] and [[whale oil|oil]]), or - there are multiple meanings of the word (see "Mercury" example on the Disambiguation page).
The pipe ("|") character is also known as a vertical bar.
There are two ways to create the pipe ("|") character: using the keyboard or choosing from a list of symbols. On English-layout keyboards, you may press ⇧ Shift+\. On Spanish keyboards, the pipe character can be obtained by pressing AltGr+1. On French (AZERTY) keyboards, the pipe character can be obtained by pressing AltGr+6. Or note that, when you are in "edit this page" mode, the "pipe" appears as the third character in the "Wiki markup" section at the bottom of the page, among the list of symbols. (You may need to choose "Wiki markup" on the pull-down menu.) Clicking on the pipe symbol there inserts it at the cursor spot, just as happens for any symbol chosen from this page.
For full details on how to use this feature, see Help:Piped link.
When not to use
[edit]First of all, keep links as simple as possible:
- Avoid making links longer than necessary:
[[George Washington|President George Washington]]
President [[George Washington]]
- It is generally not good practice to pipe links simply to avoid redirects:
[[Wolfgang Amadeus Mozart|Mozart]]
[[Mozart]]
- Unnecessary piping makes the wikitext harder to read.
- Furthermore, the number of links to a redirect page can be a useful gauge of when it would be helpful to spin off a subtopic of an article into its own page, and such links would also continue to work correctly after the spin-off.
- For example:
[[Leningrad]]currently redirects to Saint Petersburg, but one day it could be decided to spin off a dedicated article about the old city of Leningrad; when that happens, all existing links[[Leningrad]]will automatically point to the correct article, while the unnecessarily piped ones[[Saint Petersburg|Leningrad]]will point to the wrong place.
- Characters (up to punctuation) suffixed to a link will be "blended" as part of the displayed hyperlink, despite not being inside the double brackets, making it unnecessary to use piping only because the linked article name is only the first part of the word. Typical examples include a plural form or trailing affix. Given an option between pipe a link and "blending" a suffix, preferred style is to use a blended suffix:
[[public transport|public transportation]]
[[public transport]]ation
- In a link, the first letter of a page title (after the namespace prefix) is never case-sensitive. This means: It is not necessary to pipe a link to convert the first letter to lower case. So, never do this:
[[Public transport|public transport]]
[[public transport]]
- Both correctly link to the article Public transport.
Transparency
[edit]

Keep piped links as transparent as possible and follow the principle of least astonishment. Do not use piped links to create "Easter egg" links that require the reader to open them (or, at least, to hover their mouse pointer on those links to get page previews in the form of navigation popups) before understanding where they lead.
Also remember there are people who print the articles. For example, do not write this:
... and by mid-century the puns and sexual humor were (with only a few [[Thomas Bowdler|exceptions]]) back in to stay.
The readers will not see the hidden reference to Thomas Bowdler unless they click or hover over the piped exceptions link. In a print version, there is no link to select, and the reference is lost. Instead, reference the article explicitly:
... and by mid-century the puns and sexual humor were (with only a few exceptions, such as [[Thomas Bowdler]]) back in to stay.
Similarly, instead of:
After an [[1944 Bombay explosion|earlier disaster]] ...
consider:
After an earlier disaster, the [[1944 Bombay explosion]], ...
or simply:
After the [[1944 Bombay explosion]], ...
It will occasionally be useful to link to a fuller explanation of a phrase; when this is done, link the phrase, not a single word.
For example: If Pontiac's War is defined as having been
- a war launched in 1763 by a loose confederation of elements of Native American tribes,
and there is no space for further explanation in that context (this is a quote from the lead of the article), then some readers will value a link to a description of the confederation. This should not be linked from the word confederation; the link in the following phrase:
- a war launched in 1763 by a loose confederation of elements of Native American tribes
looks like a link to the article Confederation.
At a minimum, link something that, obviously, wouldn't be the title of an article under our article title conventions:
- a war launched in 1763 by a loose confederation of elements of Native American tribes.
Further, it is inappropriate to contain veiled and uncited interpretations of fiction through piped links, as in this excerpt from the The Iron Dream article, which contained over 30 interpretations of the book's allusions hidden in links:
- The pure and strong young "Trueman" (so named for the lack of mutations in his DNA) Feric Jaggar returns from the outlands of Borgravia where his family was exiled by the Treaty of Karmak with the surrounding mutant states ...
... and in wikitext:
The pure and strong young [[breeding true|"Trueman"]] (so named for the lack of mutations in his [[DNA]]) Feric Jaggar returns from the outlands of [[Austria|Borgravia]] where his family was exiled by the [[Treaty of Versailles|Treaty of Karmak]] with the [[Allies of World War I|surrounding mutant states]] ...
Such interpretation, if properly sourced, should be placed in its own section and citations provided. If the interpretation is purely that of the editor, it is original research and should be removed.
Pipe trick
[edit]The pipe trick uses the pipe character ("|") to automatically convert the label of a piped link for several kinds of wikilinks. This saves time and avoids potential errors. When the last character of a link is the pipe character, the software will remove the parenthesized part of the title and namespace prefixes and handle commas in the title. This processing happens after clicking "Publish", and the generated text is saved with the rest of the page's wiki markup. Just like for the three or four tildes when signing on Talk pages and the use of subst, in a preview, the result already shows up in the preview itself, but the conversion in the edit box is not yet shown. Press "Show changes" to see the change in the wikitext:
- Any word before the first colon (:), as well as the colon itself, is removed. This word may or may not be a namespace prefix (such as "Help:") or an interwiki prefix (such as "commons:"). If the page name is preceded by a colon, "first" refers to "first after this".
- If there is text in parentheses at the end it will be removed.
- If there are no parentheses but there is a comma, the comma and everything after it are removed.
- The link will remain in whatever case is used.
The pipe trick does not work in edit summaries, within <ref> tags, or with section links. In cases where the pipe trick doesn't work, the link has to be written out in full manually:
- between "ref" tags or gallery tags, but works with {{r}} or {{refn}}.
<ref>[[Roger Taylor (author)|]]</ref>renders in the references list as
- in edit summaries. :
/* Section */ as tested in [[WP:SAND|]]renders in the edit history as →Section: as tested in WP:SAND - on section links and links to anchors.
[[Wikipedia:Verifiability#Sources|]]renders as [[Wikipedia:Verifiability#Sources|]]
Examples
[edit]Article titles:
Pages in other namespaces:
[[Wikipedia:Verifiability|]]results in Verifiability[[User:Example|]]results in Example[[Template:Welcome|]]results in Welcome.{{tl|Welcome}}to produce {{Welcome}} is preferred instead.[[:Category:Wikipedia|]]results in Wikipedia. The colon avoids categorization of the page.[[Category:Wikipedia|]]should not be used.[[Category:Wikipedia| ]]with a space after the pipe is a category sortkey and not the pipe trick.
As with all links, it is possible to blend a suffix 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
With colons:
[[Help:Template|]]is converted to [[Help:Template|Template]], which is rendered as Template.[[Music: My life|]]is converted to [[Music: My life| My life]], which is rendered as My life – although "Music:" is not a namespace (therefore the space after the colon is not automatically removed), the shortcut works anyway.[[w:en:Pipe (computing)|]]is converted to [[w:en:Pipe (computing)|en:Pipe]], which is rendered as en:Pipe.
With case:
[[pipe (computing)|]]is converted to [[pipe (computing)|pipe]] which is rendered as pipe.[[Pipe (computing)|]]is converted to [[Pipe (computing)|Pipe]] which is rendered as Pipe.
Combinations
[edit]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 parenthesized term (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.
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. The sort key syntax of the category being like a piped link, the pipe trick also works for category tags, even though it is not useful there.
In case of combinations of suppressible parts, the following rules apply:
- If the link name involves both one or more commas and a final parenthesis, only the parenthesis is suppressed:
[[Yours, Mine and Ours (1968 film)|Yours, Mine and Ours]]is shown on the page as: Yours, Mine and Ours
- If there are several prefixes, which can occur, for example, for an interlanguage link, only the first is suppressed:
[[:es:Wikipedia:Políticas|Wikipedia:Políticas]]is rendered as: Wikipedia:Políticas
- If there are several commas, only the part up to the first comma is shown:
[[Elgin, Kershaw County, South Carolina|Elgin]]results in: Elgin
- For the rest, if there is both an initial part and a final part that can be omitted, both are suppressed:
[[Wikipedia:Manual of Style (Persian)|Manual of Style]]produces: Manual of Style
Other examples:
[[commons:Boston, Massachusetts|]]is converted to [[commons:Boston, Massachusetts|Boston]], which is rendered as Boston.- Parameters and variables:
[[w:{{{1}}}|]]does not give [[w:{{{1}}}|{{{1}}}]].- Calling the template with a value of parameter 1 gives a working link in the case of substitution only.
[[w:en:{{FULLPAGENAME}}|]]does not give [[w:en:{{FULLPAGENAME}}|en:{{FULLPAGENAME}}]].[[m:{{FULLPAGENAME}}|]]does not give [[m:{{FULLPAGENAME}}|{{FULLPAGENAME}}]]
| Wikitext | Displays as |
|---|---|
[[project:a (b)|]] |
a |
[[w:project:a (b)|]] |
project:a |
[[:de:project:a (b)|]] |
project:a |
[[wiktionary:project:a (b)|]] |
project:a |
[[wiktionary:de:project:a (b)|]] |
de:project:a |
[[wikibooks:project:a (b)|]] |
project:a |
[[wikiquote:project:a (b)|]] |
project:a |
[[wikisource:project:a (b)|]] |
project:a |
[[w:en:{{FULLPAGENAME}}|]] |
[[w:en:Wikipedia:Piped link|]] |
[[w:en:{{FULLPAGENAME}}|en:{{FULLPAGENAME}}]] |
en:Wikipedia:Piped link |
[[m:{{FULLPAGENAME}}|]] |
[[m:Wikipedia:Piped link|]] |
[[m:{{FULLPAGENAME}}|{{FULLPAGENAME}}]] |
Wikipedia:Piped link |
Reverse pipe trick
[edit]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. This is called the reverse pipe trick.
- On page "A (c)",
[[|B]]is automatically converted to[[B (c)|B]].For example, if the link[[|Agonizer]]were placed in Agonist (disambiguation), the link would be expanded to[[Agonizer (disambiguation)|Agonizer]]. - Similarly, on page "A, c",
[[|B]]is automatically converted to[[B, c|B]].For example, if the link[[|Palo Alto]]were placed in Pacific Grove, California, the link would be expanded to[[Palo Alto, California|Palo Alto]].
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.
Slash trick
[edit]You can achieve a similar effect for subpages by adding a trailing slash. For example, on the page Washington, typing [[/State/]] generates State, which links to Washington/State. Without using the slash trick, [[/Subpage]] becomes /Subpage. However, unlike the pipe trick, the slash trick is not expanded in the saved wiki markup.[clarification needed] The slash trick only works in namespaces where subpages are enabled.
Piped category links
[edit]In the case of a category link, a piped link overrides the alphabetical sort order of the article, as shown on the linked category page.
For example, in a hypothetical new article Albert Einstein, using [[Category:Quantum physicists]] places him in Category:Quantum physicists. And that category page will list him as "Albert Einstein". But if this link is used in this simplest form, it will list the title (lemma) among the "A"s, instead of the "E"s (where he belongs), because it sorts on the article's name, "Albert Einstein".
One way to impose correct sort order is to use [[Category:Quantum physicists|Einstein, Albert]], which makes that category page list "Albert Einstein" among the "E"s, by sorting it as if it were "Einstein, Albert" rather than "Albert Einstein".
However, the actual Albert Einstein page has dozens of category links. Piping every category link would be unattractive. As is standard for most "person" pages, that page uses the template {{DEFAULTSORT:Einstein, Albert}} to override the default sorting for category links. Thus [[Category:Quantum physicists]] on that page, places him in Category:Quantum physicists as "Albert Einstein", and makes that category page sort him as "Einstein, Albert", without need of a piped link, and likewise for other category links.
But because of this template that page needs to pipe the category link, [[Category:Einstein family|Albert]], to place him in Category:Einstein family and make (only) that category alphabetize him under "Albert".
Templates
[edit]The pipe character is also used when supplying parameters to templates; this is not the same thing as a piped link.
Some templates automatically add link formatting, as seen here with the previous_awards field. Those automatic links won't work with the normal piped links; for them, instead of a normal pipe, use the magic word {{!}}, as seen here with the current_awards field.
See also
[edit]- ^ [[Roger Taylor (author)|]]