Piped link

Revision as of 01:18, 8 October 2007 by C Michael Gibson (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is a copy of the master page at Meta. Do not edit this copy.
Edits will be lost in the next update from the master page. See below for more information.


Editing
Start new pages
Page name

Referencing
Links
Piped links
Interwiki linking
Footnotes (References)

Formatting
Wikitext
Lists & Tables
Image & file uploads
Formulae

Organising
Sections
Categories
Redirects (forward)
Namespaces
Moving a page
Page size

Fixing mistakes
Reverting edits
Show preview

Saving effort
Editing shortcuts
Edit toolbar
Magic words
Templates
Variables
Calculation

Communicating
Edit summary
Talk page
Edit conflict
Minor edit

Other
Characters
Sandbox


Template:Phh:Piped link A piped link is a link within the project or to a sister project which is labeled differently from the name of the page it links to. This allows linking a word or phrase within the text of a page rather than using "see also", even if the wording does not exactly correspond with the name of the other page. With a suitable browser and depending on the preferences set, one can still see what page is linked to: when you point at the link, the name shows up in a hover box and is also shown in the status bar.

For instance:

[[coffeehouse setup|How to set up a coffee house]]

will show: How to set up a coffee house

The term piped refers to the use of the pipe character "|" used to separate the good description from the actual link. This character is named after an alternative use of it; see Pipe (computing).

Another example would be [[train station|station]] rendering as station. This is useful where the word "station" is used in an article on trains; from the context, it would be clear that a train station is meant. The piped link is more convenient to the user than a link to station which is a disambiguation page.

Using a redirect as an alternative

An alternative is simply using [[How to set up a coffee house]] to create How to set up a coffee house (note that, unlike above, what pops up when you point at the link, if applicable for your browser, is simply the text already shown), and making How to set up a coffee house a redirect page.

This is convenient if the redirect is already there or will also be of use elsewhere; however, there are a few drawbacks:

  • the popup does not show the page one will arrive at
  • "Related changes" does gives the changes in the redirect page
  • the redirect message on the new page slightly clutters it

On the other hand, one may prefer the link title to provide some information that is not in the name of the page one links to, such as the value of a unit in terms of other units. In that case one can make a page whose pagename is the info one wants in the link title, and which redirects to a page with a more appropriate name. See e.g. w:Template:Ft, containing [[30.48 cm|ft]], with the page w:30.48 cm redirecting to w:Foot (unit of length).

Automatic conversion of the wikitext

Pipe trick

If in a piped link the part after the "|" is left empty, it is converted to an abbreviated form of the page name on the left, as follows:

  1. any namespace prefix (such as "Help:") or an interwiki prefix (such as "commons:") is removed
  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 is removed

For example:

  • [[w:en:Pipe (computing)|]] is converted to [[w:en:Pipe (computing)|en:Pipe]], which is rendered as en:Pipe
  • [[Help:Template|]] is converted to [[Help:Template|Template]], which is rendered as Template
  • [[commons:Boston, Massachusetts|]] is converted to [[commons:Boston, Massachusetts|Boston]], which is rendered as Boston.

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. Save and press Edit again to see the result of the conversion.

For links between language versions of Wikipedia and between language versions of Wiktionary, the pipe trick is either not applicable (if the link comes at the edge) or is limited in use because of the starting colon.

In some projects and some cases the pipe trick does not work and the piped link wikitext is not even rendered as a link.

Examples

*[[project:a (b)|]]
*[[w:project:a (b)|]]
*[[de:project:a (b)|]]
*[[wiktionary:project:a (b)|]]
*[[wiktionary:de:project:a (b)|]]
*[[wikibooks:project:a (b)|]]
*[[wikiquote:project:a (b)|]]
*[[wikisource:project:a (b)|]]

produces

Inverse pipe trick

On page "A (c)", [[|b]] is automatically converted to [[b (c)|b]].

Similarly, on page "A, c", [[|b]] is automatically converted to [[b, c|b]].

Syntax for external links

For external links a space is used instead of a pipe character; see Help:Editing. A general term used for both is also clean link.

See also


edit

Wikipedia-specific help

Template:Ph:Piped link


This page is a copy of the master help page at Meta (for general help information all Wikimedia projects can use), with two Wikipedia-specific templates inserted. To update the main text, edit the master help page for all projects at m:Piped link. For Wikipedia-specific issues, use Template:Ph:Piped link (the extra text at the bottom of this page) or Template:Phh:Piped link for a Wikipedia-specific lead (text appears at the top of this page). You are welcome to copy the exact wikitext from the master page at Meta and paste it into this page at any time. To view this page in other languages see the master page at Meta.


Linked-in.jpg