Jump to content

Aletopedia:Piped link

From Wikipedia, the free encyclopedia

Template:Short description {{#invoke:redirect hatnote|redirect|1}} Template:Wikipedia how-to Template: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 ("<syntaxhighlight lang="text" class="" style="" inline="1">|</syntaxhighlight>") 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

Piped links are useful for preserving the grammatical structure and flow of a sentence when:

  1. 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
  2. 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 Template:Keypress. On Spanish keyboards, the pipe character can be obtained by pressing Template:Keypress. On French (AZERTY) keyboards, the pipe character can be obtained by pressing Template:Keypress. 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

{{#invoke:Shortcut|main}} {{#invoke:redirect hatnote|redirect|1}} First of all, keep links as simple as possible:

  • Avoid making links longer than necessary:

Template:Block indent

Template:Block indent

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 piping a link and "blending" a suffix, the preferred style is to use a blended suffix:

Template:Block indent

  • 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:

Template:Block indent

Both correctly link to the article Public transport.

Transparency

{{#invoke:redirect hatnote|redirect|1}}

Template:Anchor {{#invoke:Shortcut|main}}

File:Adventkalender AR.jpg
Wikipedia is not an advent calendar, so don't tease the reader.

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:

Template:!mxt

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:

Template:Mxt

Similarly, instead of:

Template:!mxt

consider:

Template:Mxt

or simply:

Template:Mxt

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:

Template:!xt

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:

Template:Xt

Further, it is inappropriate to convey 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:

Template:!xt

... and in wikitext:

Template:!mxt

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

<section begin=PIPETRICK /> Template:Short The pipe trick uses the pipe character ("<syntaxhighlight lang="text" class="" style="" inline="1">|</syntaxhighlight>") 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:

  1. 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".
  2. If there is text in parentheses at the end it will be removed.
  3. If there are no parentheses but there is a comma, the comma and everything after it are removed.
  4. The link will remain in whatever case is used.

The pipe trick does not work in edit summaries, within <syntaxhighlight lang="wikitext" inline>Cite error: Closing </ref> missing for <ref> tag</syntaxhighlight> renders in the references list as Template:Dummy footnote

  • in edit summaries. :<syntaxhighlight lang="text" class="" style="" inline="1">/* Section */ as tested in [[WP:SAND|]]</syntaxhighlight> renders in the edit history as →‎Section: as tested in WP:SAND
  • Template:Trackedon section links and links to anchors. <syntaxhighlight lang="text" class="" style="" inline="1">[[Wikipedia:Verifiability#Sources|]]</syntaxhighlight> renders as [[Wikipedia:Verifiability#Sources|]]

Examples

Article titles:

  • <syntaxhighlight lang="text" class="" style="" inline="1">[[Pipe (computing)|]]</syntaxhighlight> results in Pipe
  • <syntaxhighlight lang="text" class="" style="" inline="1">[[Nashville, Tennessee|]]</syntaxhighlight> results in Nashville

Pages in other namespaces:

  • <syntaxhighlight lang="text" class="" style="" inline="1">[[Wikipedia:Verifiability|]]</syntaxhighlight> results in Verifiability
  • <syntaxhighlight lang="text" class="" style="" inline="1">[[User:Example|]]</syntaxhighlight> results in Example
  • <syntaxhighlight lang="text" class="" style="" inline="1">[[Template:Welcome|]]</syntaxhighlight> results in Welcome. <syntaxhighlight lang="text" class="" style="" inline="1">{{tl|Welcome}}</syntaxhighlight> to produce Template:Tl is instead preferred.
  • <syntaxhighlight lang="text" class="" style="" inline="1">[[:Category:Wikipedia|]]</syntaxhighlight> results in Wikipedia. The colon avoids categorization of the page. <syntaxhighlight lang="text" class="" style="" inline="1">[[Category:Wikipedia|]]</syntaxhighlight> should not be used. <syntaxhighlight lang="text" class="" style="" inline="1"></syntaxhighlight> with a space after the pipe is a category sortkey and not the pipe trick.

As with all links, it is also possible to blend a suffix when using the pipe trick:

  • <syntaxhighlight lang="text" class="" style="" inline="1">[[pipe (computing)|]]s</syntaxhighlight> generates the wiki markup <syntaxhighlight lang="text" class="" style="" inline="1">pipes</syntaxhighlight> rendered as pipes
  • <syntaxhighlight lang="text" class="" style="" inline="1">[[pipe (computing)|]]mill</syntaxhighlight> generates the wiki markup <syntaxhighlight lang="text" class="" style="" inline="1">pipemill</syntaxhighlight> rendered as pipemill

<section end=PIPETRICK />With colons:

  • <syntaxhighlight lang="wikitext" inline>[[Help:Template|]]</syntaxhighlight> is converted to <syntaxhighlight lang="text" class="" style="" inline="1">Template</syntaxhighlight>, which is rendered as Template.
  • <syntaxhighlight lang="wikitext" inline>[[Music: My life|]]</syntaxhighlight> is converted to <syntaxhighlight lang="text" class="" style="" inline="1"> My life</syntaxhighlight>, 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.
  • <syntaxhighlight lang="wikitext" inline>[[w:en:Pipe (computing)|]]</syntaxhighlight> is converted to <syntaxhighlight lang="text" class="" style="" inline="1">en:Pipe</syntaxhighlight>, which is rendered as en:Pipe.

With case:

  • <syntaxhighlight lang="wikitext" inline>[[pipe (computing)|]]</syntaxhighlight> is converted to <syntaxhighlight lang="text" class="" style="" inline="1">pipe</syntaxhighlight> which is rendered as pipe.
  • <syntaxhighlight lang="wikitext" inline>[[Pipe (computing)|]]</syntaxhighlight> is converted to <syntaxhighlight lang="text" class="" style="" inline="1">Pipe</syntaxhighlight> which is rendered as Pipe.

Combinations

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 Template:Em a final parenthesis, only the parenthesis is suppressed: <syntaxhighlight lang="text" class="" style="" inline="1">[[Yours, Mine and Ours (1968 film)|]]</syntaxhighlight> 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: <syntaxhighlight lang="text" class="" style="" inline="1">[[:es:Wikipedia:Políticas|]]</syntaxhighlight> is rendered as: Wikipedia:Políticas
  • If there are several commas, only the part up to the first comma is shown: <syntaxhighlight lang="text" class="" style="" inline="1">[[Elgin, Kershaw County, South Carolina|]]</syntaxhighlight> results in: Elgin
  • For the rest, if there is both an initial part and a final part that can be omitted, both are suppressed: <syntaxhighlight lang="text" class="" style="" inline="1">[[Wikipedia:Manual of Style (Persian)|]]</syntaxhighlight> produces: Manual of Style

Other examples:

  • <syntaxhighlight lang="wikitext" inline>[[commons:Boston, Massachusetts|]]</syntaxhighlight> is converted to <syntaxhighlight lang="text" class="" style="" inline="1">Boston</syntaxhighlight>, which is rendered as Boston.
  • Parameters and variables:
  • <syntaxhighlight lang="wikitext" inline>[[w:{{{1}}}|]]</syntaxhighlight> does Template:Em give <syntaxhighlight lang="text" class="" style="" inline="1">[[w:{{{1}}}|{{{1}}}]]</syntaxhighlight>.
  • Calling the template with a value of parameter 1 gives a working link in the case of substitution only.
  • <syntaxhighlight lang="wikitext" inline>[[w:en:Aletopedia:Piped link|]]</syntaxhighlight> does Template:Em give <syntaxhighlight lang="text" class="" style="" inline="1">[[w:en:{{FULLPAGENAME}}|en:{{FULLPAGENAME}}]]</syntaxhighlight>.
  • <syntaxhighlight lang="wikitext" inline>[[m:Aletopedia:Piped link|]]</syntaxhighlight> does Template:Em give <syntaxhighlight lang="text" class="" style="" inline="1">[[m:{{FULLPAGENAME}}|{{FULLPAGENAME}}]]</syntaxhighlight>
Wikitext Displays as
<syntaxhighlight lang="wikitext" inline>[[project:a (b)|]]</syntaxhighlight> a
<syntaxhighlight lang="wikitext" inline>[[w:project:a (b)|]]</syntaxhighlight> project:a
<syntaxhighlight lang="wikitext" inline>[[:de:project:a (b)|]]</syntaxhighlight> project:a
<syntaxhighlight lang="wikitext" inline>[[wiktionary:project:a (b)|]]</syntaxhighlight> project:a
<syntaxhighlight lang="wikitext" inline>[[wiktionary:de:project:a (b)|]]</syntaxhighlight> de:project:a
<syntaxhighlight lang="wikitext" inline>[[wikibooks:project:a (b)|]]</syntaxhighlight> project:a
<syntaxhighlight lang="wikitext" inline>[[wikiquote:project:a (b)|]]</syntaxhighlight> project:a
<syntaxhighlight lang="wikitext" inline>[[wikisource:project:a (b)|]]</syntaxhighlight> project:a
<syntaxhighlight lang="wikitext" inline>[[w:en:Aletopedia:Piped link|]]</syntaxhighlight> [[w:en:Aletopedia:Piped link|]]
<syntaxhighlight lang="wikitext" inline>en:Aletopedia:Piped link</syntaxhighlight> en:Aletopedia:Piped link
<syntaxhighlight lang="wikitext" inline>[[m:Aletopedia:Piped link|]]</syntaxhighlight> [[m:Aletopedia:Piped link|]]
<syntaxhighlight lang="wikitext" inline>Aletopedia:Piped link</syntaxhighlight> Aletopedia:Piped link

Reverse pipe trick

If the title of the article you are editing includes a parenthesized term or a comma, placing a pipe at the Template:Em 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)", <syntaxhighlight lang="wikitext" class="" style="" inline="1">[[|B]]</syntaxhighlight> is automatically converted to <syntaxhighlight lang="wikitext" class="" style="" inline="1">B</syntaxhighlight>.Template:PbFor example, if the link <syntaxhighlight lang="wikitext" class="" style="" inline="1">[[|Agonizer]]</syntaxhighlight> were placed in Agonist (disambiguation), the link would be expanded to <syntaxhighlight lang="wikitext" class="" style="" inline="1">Agonizer</syntaxhighlight>.
  • Similarly, on page "A, c", <syntaxhighlight lang="wikitext" class="" style="" inline="1">[[|B]]</syntaxhighlight> is automatically converted to <syntaxhighlight lang="wikitext" class="" style="" inline="1">B</syntaxhighlight>.Template:PbFor example, if the link <syntaxhighlight lang="wikitext" class="" style="" inline="1">[[|Palo Alto]]</syntaxhighlight> were placed in Pacific Grove, California, the link would be expanded to <syntaxhighlight lang="wikitext" class="" style="" inline="1">Palo Alto</syntaxhighlight>.

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

Template:Short You can achieve a similar effect for subpages by adding a trailing slash. For example, on the page Washington, typing Template:Demo inline, which links to Washington/State. Without using the slash trick, Template:Demo inline. However, unlike the pipe trick, the slash trick is not expanded in the saved wiki markup.Template:Clarify The slash trick only works in namespaces where subpages are enabled.

{{#invoke:Labelled list hatnote|labelledList|Main article|Main articles|Main page|Main pages}}

In the case of a category link, a piped link has a different function - it overrides the alphabetical sort order of the article, as shown on the linked category page. It does not change the appearance to the reader as a regular piped link.

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 magic word Template:Magic word link 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

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

Template:Wikipedia help pages