Help:Link

This page explains how to make the wikilink, interwiki link, or external web link (as hyperlinks) connections on FAMEPedia, which gives readers one-click access to other FAMEPedia pages, other Wikimedia projects, and external websites.

A link has various (changeable) appearances on the "anchor" page, and the "target" page, which owns the "backlinks", and which can count the links to it with the FP:What links here tool.

For a short list of some basic shortcuts, see FAMEPedia:Cheatsheet.

For guidelines on how links should be used in FAMEPedia, see FAMEPedia:Manual of Style/Linking.

Wikilinks (internal links)
A wikilink (or internal link) is a link from a page to another page within English FAMEPedia (this last page is called the link target).

In wikitext, links are enclosed in doubled square brackets like this: Use a vertical bar "|" (the "pipe" symbol – see FAMEPedia:Piped link for how to type one) to create a link while labelling it with a different name on the original page. The first term inside the brackets is the page you would be taken to (the link target), while anything you type after the vertical bar is what that link looks like on the original page (the link label). Here are some examples:
 * is seen as "1234" in text and links to page "1234".
 * is labelled "b" on this page but links to page "a". Example: a|b.
 * gives ab. So does : a|ab. The code   gives a|bc, just as   does. However, all four of these examples will link to page "a".
 * gives ab.
 * gives a:b since the colon is outside the end brackets. The same goes for  or.
 * gives ab. (Double apostrophes turn on and off italics.)
 * gives ab.
 * gives a|bcd, and shows an example of link trailing.
 * gives a b. (The nowiki tag is needed to turn off the so-called "linktrail rules".)
 * gives a|b c.

Links with a specified label are said to be "piped" because the pipe symbol is used ("|"). For certain types of link, the label will be generated automatically if a pipe is typed, even with no label after it (meaning you don't have to type one). See Help:Pipe trick.

The link target is case-sensitive except for the first character (so  links to "Atom" but   does not). Other ways in which link targets are reinterpreted are described further: Conversion to canonical form.

If the target of a wikilink does not exist, it is displayed in red color and is called a "red link". Here is a red link example. If a red link is clicked, the user is taken to a blank page where it is possible to create a page using that red linked title. While on that blank page, other red links to this (non-existent) title can be detected using the "What links here" feature.

If the target of a link is the same as the page on which it appears (a self-link), it is displayed in bold font, as with: Help:Link.

When an edit is previewed before saving, if the target of a newly made link turns out to be a disambiguation page, such as the Peacemaker page, the link should be changed to one of the choices on that page unless the link is purposeful in a hatnote. If necessary, the new link can be piped, such as in Peacemaker, which appears as Peacemaker and links to the article about the fictional characters. Readers should not be directed to disambiguation pages unless there is no other option but to do so.

Attempting to link normally to an image page, category page or interlanguage link will produce a different effect: this will respectively place the image on the page, add the page to the category, or create an interlanguage link at the edge of the page. To override this behavior, insert an initial colon ":", as in,  ,.

Inserting and deleting internal links
Links are inserted and deleted when editing source simply by adding or removing pairs of square brackets enclosing text (plus handling piped links). There are some helpful tools:
 * When using the WikEd source editor, selectable from Preferences > Gadgets > Editing, there is a "Wiki link" button (typically the first button on the bottom row). When editing, if some text is highlighted, clicking the Wiki link button will enclose it in double quotes, i.e., Wikilink it. If, however, some text is highlighted that includes one or more internal links—in many cases just a single internal link with its delimiting brackets—they will be removed instead. For a single link without pipe, the Wiki link button will toggle between linking and unlinking.
 * When using the visual editor, selecting some text, then clicking the link icon above the text box (two links of a chain) will allow the link to be added, offering a selection of possible matches and the ability to pipe.

Interwiki links
An interwiki link links to a page on another Wikimedia project website, such as Meta or another language FAMEPedia. The target site must be on the interwiki map specified for the source wiki. These links have the same ... syntax as wikilinks (see previously), but take a prefix ":x:" which specifies the target site.

For example,  links to the "Help:Link" page on Meta, while   links to page "Athens" on Wikimedia Commons as: commons:Athens.

Interwiki links can be piped, just as with wikilinks. Remember that an interlanguage link should be preceded by a colon if it is to be displayed, where it is inserted in the text, as an inline interlanguage link; otherwise it will be displayed in the list of interlanguage links at the side of the page (which is appropriate only if it is the most closely corresponding page in the other language FAMEPedia). Thus (incorporating the pipe trick),  would be used to link to Wikilink on Japanese FAMEPedia. Example: ( links to URL on Japanese FAMEPedia).

Interwiki links (like external links) are displayed in a slightly paler blue than ordinary wikilinks. The MediaWiki page formatting does not detect whether these target pages exist, so they are never displayed in red.

http: and https:
In mid-2015, FAMEPedia and all other Wikimedia sites were changed to use HTTPS to encrypt all traffic. Accessing a URL like  will result in the webserver redirecting you to. Therefore, when making an external-style link to an internal page (that is, using single square brackets, or a bare URL),  should be specified to avoid the needless redirect, as in.

In the past, when FAMEPedia could be accessed via either HTTP or HTTPS, a protocol-relative URL could be used to make an external link (or external-style link to an internal page) which would use  or   depending on how the page the link appeared on was accessed, as in. However, as all Wikimedia sites now require HTTPS, this linking style is obsolete and should no longer be used. or  should be explicitly specified as appropriate for the target site (preferring , where available).

What is an "anchor"?
The word "anchor" has two opposing meanings:
 * In the context of a link from an anchor to a target, it is the starting place.
 * In the context of the template anchor, an "anchor" is a landing place for a link to jump to.

The anchor template proceeds to automatically create some invisible coding from certain text in the "landing place", taking into account certain parameters in reference templates in general. So for developers the word "anchor" may refer
 * to the landing place in general,
 * to the mostly invisible code, or
 * to the text and parameters from which the code is created.

Section linking (anchors)
To link to a section or subsection in another page, append a  and the section name to the page name:

If linking in the same page, omit the page name and use a  and the section name:

Omitting the page name is recommended when linking to a section in the same page because the link will work as expected when previewing changes or after moving the page.

Note that  are entirely case sensitive, in contrast to article links, where the first letter is not case sensitive.

Template

To link to a section so that it is formatted with the section symbol instead ( rather than as Page name), use the template Section link (or slink):

When using the template, certain characters  require encoding when linking to a section: For example, the section "[Closed] Complaint" can be linked with. Links in the table of contents will automatically make this encoding, so the URL can be copied from there. However, that URL will also encode other characters which do not interfere with templates or wikicode, so the result may look ugly.

For more information, see Help:Section. See also.

Specifics
When a link contains a section title (as in the examples above), the title actually points to an HTML anchor on the target page. In addition to anchors created automatically by section titles, there are times when it's advantageous to create an anchor on a smaller unit of text, such as a specific paragraph (see below). This can be done using anchor name, or alternatively, the HTML code (see Anchor syntax). Anchors are also used when renaming a section, yet still allowing links to the old name to function, or similarly, allowing linking to a section using an abbreviation; see MOS:HEADINGS for more info. Links to anchors can also be added to external URLs and to interwiki links, again using the  syntax.

Section links still work through page names that are redirects. For example, if Danzig redirects to Gdańsk, then Danzig will link to the "History" section of the article Gdańsk. It is also possible for the target of a redirect to be defined as a specific section or anchor of a page (these work only if JavaScript is enabled). Indeed, according to the Manual of Style, it may be preferable to define such redirects, and use them when linking to those sections/anchors, rather than linking using the or  syntax. This way, if the section or anchored text later becomes its own article, links via the redirect won't need to be rewritten.

For example, FAMEPedia:Section link redirects specifically to the section Help:Link on this page. A quirk of the way this works is that if one were to add a section name when using such a link, it would override the section specified by the redirect. So FAMEPedia:Section link would go to the "Interwiki links" section of this page. Such overriding of section redirects should be avoided.

Duplicate section names
If more than one section on a destination page has the same title, a link to the title is to the first section with that title. If the link should be to another section with the title or a title that differs only in capitalization (Example vs. EXAMPLE), append to the linked title _2, _3, and so on, without a space (or 2, 3, and so on with a space), counting from the top of the destination page and without regard to whether a section is a section or a subsection. For example, multiple sections titled "History" may be linked to as "History", "History_2" (or "History 2"), and so on.

Linking to part of a section
Anchors can also be used to link to any part of a section. For example, if you want to link to the fifth sentence of a section, you just place an anchor at the start of that sentence, and you can then link to that anchor in the same way as you would link to any other anchor.

However, just as with section names, duplicate anchor names only link to the first one. Since anchors aren't displayed you have a much greater freedom in picking unique anchors, such as by appending the current date and time to the anchor name (for example, by naming an anchor for section "ThisSection" like so: ).

Anchors can be placed anywhere, including at the start of a clause, and inside notes and citations, though it is advisable to test first in your sandbox before trying some exotic new kind of location for the first time. Also the anchor has to be placed after any indicators that are only recognized at the start of a line (such as == or ===, etc, for new section, * for new bullet point, : for indentation), as the anchor should still work, but the start-of-line indicator usually no longer will (and you may not always notice this, perhaps especially if you are in a hurry).

There are a small number of special anchor names. See.

Table row linking
To create an anchor for a row of a table, see. However,  and   are reserved names that link to the top of a page and the table of contents, respectively.

Piped link
A piped link is an internal link or interwiki link where the link target and link label are both specified. This is needed in the case that they are not equal, while also the link label is not equal to the link target with the last word extended: 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 target page. With a suitable browser and depending on the preferences set, one can still see the link target: when you point at the link, the name shows up in a hover tooltip and is also shown in the status bar.
 * (label = target, no pipe needed)
 * produces cheese, linked to the article Cheese.
 * (label = target + extension ["s"], no pipe needed)
 * produces cheeses, linked to the article Cheese.
 * (label = part of target, pipe required)
 * produces cheese, linked to the article Blue cheese.
 * (label = target + additional text ["blue"], pipe required)
 * produces blue cheese, linked to the article Cheese.
 * (label is completely different from target, pipe required)
 * produces that stuff, linked to the article Cheese.

For instance:

will show: 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 might be a disambiguation page.

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

There are various tricks to get the same result with less typing:
 * Leave the part to the right empty – the "pipe trick"
 * Leave the part to the left empty – the ""
 * Just attach text to the link, as in " trains ", see MOS:PIPE.

Using a redirect as alternative
An alternative to a piped link is simply using redirect pages. To create How to set up a coffee house, use  and make this a redirect to coffeehouse setup (note that, unlike previously, the tooltip that shows when you point at the link, if applicable for your browser, is simply the text already shown).

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


 * the tooltip does not show the page one will arrive at
 * "Related changes" gives the changes in the redirect page not the redirect target
 * the redirect message on the target page slightly clutters it

Combining a piped link and a redirect, one can provide some information that is not the name of the page one links to in the hover tooltip, i.e. the following pipe to a redirect  will display a tooltip "United Nations Organization" when hovering over UNO, thereby explaining the abbreviation.

Automatic conversion of wikitext with the pipe trick
If in a piped link the part after the "|" is left empty, it is converted to an abbreviated form of the linked page, as follows:


 * 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 be in whatever case is used.

Just like for the three or four tildes when signing on Talk pages and the use of, 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.


 * Category tag
 * 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.


 * Examples using colons
 * is converted to Template, which is rendered as Template.
 * is converted to 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.
 * is converted to en:Pipe, which is rendered as en:Pipe.


 * Case examples
 * is converted to pipe which is rendered as pipe.
 * is converted to Pipe which is rendered as Pipe.


 * Comma example
 * is converted to Boston, which is rendered as Boston.


 * Other examples
 * Parameters and variables:
 * does not give.
 * Calling the template with a value of parameter 1 gives a working link in the case of substitution only.
 * does not give en:.
 * does not give


 * 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)
 * 
 * en:
 * 
 * 

These examples appear as:


 * a
 * project:a
 * project:a
 * project:a
 * de:project:a
 * project:a
 * project:a
 * project:a
 * 
 * en:
 * 
 * 

Inverse pipe trick
On page "A (c)",  is automatically converted to B.

Similarly, on page "A, c",  is automatically converted to B.

Further examples are here.

Subpage links
A wikilink needs a subpage. A wikilink to its parent page is ../, and, although no page name is given, the fullpagename is rendered. On the parent a wikilink to a subpage can use [[/subpagename] ] to render a subpagename instead.

Although subpages are created in article space, subpage linking does not fully function there. Subpage linking works as expected to link to any pages under a root parent page:
 * section linking: ../
 * child-to-child subpage linking: subpagename''] ]
 * parent's parent ../../
 * including the [[FP:pipe trick|pipe trick]]
 * and including transclusions: {{../} } and {{/subpagename} }

Consider that there are about 140 arranged in 97 branches, 35 of which have two subpages, and 5 of which have three subpages. Subpage links save typing. Say you're editing this closely related group of fullpagenames:


 * FAMEPedia:Manual of Style/Accessibility/Signatures
 * FAMEPedia:Manual of Style/Accessibility/Data tables tutorial
 * FAMEPedia:Manual of Style/Accessibility/Data tables tutorial/Internal guidelines

To see this page's array of subpage variables and markup four levels deep, see /one/two/three/four, and from there go to level two at one/two.

Markup [ [../]] addresses the basepagename, except when a pagename includes a / slash character (allowed), the basepagename/subpagename variables' characters are skewed. To see all this, and how adding an extra ../ construct fixes the resulting redlink, see /sub/page/name1/sub/page/name2/subpage level 3, and from there go to sub/page/name2.

Note that the top of every subpage shows the navigation links to all parent subpagenames. From these you can easily gauge levels and linking constructs.

For more information:
 * See FAMEPedia:Page name.
 * Create a subpage by using a red link.
 * See m:Help:Link.
 * See examples at Link/a/b and m:Help:Link/a/b.

ISBN, RFC and PMID automatic links
Key words ISBN, PMID and RFC will generate internal or external links automatically:

To prevent such automatic linking, use a s between the identifier and the value or a non breaking space.

Changing link appearance
The ways that various links are displayed in browsers, as described above, are the default display styles in the default skin. Users can change the way they see links:
 * By selecting a different skin.
 * By applying a user style using CSS.
 * By changing the "Underline links" or "Format broken links like this" value on the Appearance tab of user preferences.
 * By setting the "threshold for stub display" on the Appearance tab of user preferences. This causes links to pages in mainspace to be displayed in a distinctive fashion – dark red by default – if the wikitext of the target page has less than a specified number of bytes. (Any section markers in the link are ignored. Links to redirects are displayed in the normal style.)

Hover tooltips
In many browsers, holding the cursor over a link (mouseover) shows a hover tooltip containing the text of the link's HTML  attribute. MediaWiki – the software which runs FAMEPedia – sets this to the target page name (without any section indication) if it's a wikilink, the page name with prefix if it's an interwiki link, and the link address (URL) if it's an external link. (This can be switched off in the user preferences.) The browser may also show similar information, including any section indication, in the status bar.

For these effects a piped link is useful even if it is not followed; for example, for displaying the meaning of an acronym. It is possible to produce a hover tooltip without a link, using the H:title template.

Disallowed characters
A link whose target contains disallowed characters (see FP:Page name) will be displayed without markup, as in.

Conversions are automatically made to non-literal characters in wiki and interwiki links. For example,  becomes. However, the opposite is true for external links; literal characters are converted into non-literal characters. For example, most browsers convert  to.

Some characters in a web address link need to be represented as escape characters because they are reserved for FAMEPedia edits. Examples include  for ,   for  ,   for  ,   for  ,   for  ,   for  , and   for. More can be found by reading about percent encoding. Numeric character references (e.g.  or  ) should not be used in external links because the ampersand character (&) has a special meaning in a URL.

A code like  in a redirect disables it, although the link works from the redirect page. For a redirect that works, the redirect page shows the canonical form of the target, unlike its preview page, which renders the link in the usual way.

Links containing URL query strings
Because the ampersand character (&) is disallowed, it is not possible to create an ordinary link containing  or   in the URL query string. These kinds of links can be helpful in user pages. Also, a redirect page can have categories and you might wish to view or edit these in a single click.

The following syntax shows the use of the magic word fullurl as it would appear in a template constructed to append  to the URL query string: [ ]

Note that this will render as an external link rather than as an internal link and for this reason it might not appear in what-links-here queries associated with the target page.

Link reports
The navigable links to a page are wikilinks, redirects, and external-styled wikilinks. The orphan tag can be placed on pages with no incoming wikilinks.

To a page
Each link to a page is a link to a name. No one report shows all links to the content.

The What links here tool, on every page, will report all wikilinks and all redirects to the content of that page. (You get the wikilinks to the redirects too.) The search parameter linksto will find wikilinks only. Both report (invisible) wikilinks placed by a transclusion through a { {template}}. The difference between them is that linksto reports a count of links to a page name, while WhatLinksHere reports a map of links to the page as content.

To a section
The navigable links to a section of a page are wikilinks, redirects, and URL-styled wikilinks. The difference between a redirect and a wikilink is most pronounced where a redirect targets a section, when you cannot add your own #section to it even though it appears as. A wikilink that links to a section and that appears as  can link to that section through the canonical page name (the title on the page with the actual content) or through the page name of any redirect to it, in which case the page name is the name of a redirect page.

To find wikilinks to a section requires two or more reports.


 * 1) Show redirects only, an external tool available from the What links here page, reports redirects to the content of a section. (No matter which page name you give it, you get all the redirect page names.) Look past any "No anchor or section" group of redirects, and any "invalid" sections, to see if your particular section name is explicitly listed, because then the redirect pages under it can have incoming links that will then go to that section. ("What Links Here" also has a "show redirects" report, but it doesn't specify if the redirect goes to any particular section.)
 * 2) Use "What Links Here" on any redirect pages found in the previous step.
 * 3) Use Links to to create a group of search links that will each report some links to a section. It can work with only one page name at a time. For each search link given, just change the page name in the query to each redirect in turn.

The more redirects there are, the more reports there are to run. If there are no redirects involved, one report from "Links to" is enough.

From a page
To report links from a page, you just list all the wikilinks on that page. One way to send a query to the API is by creating an external link. For example, using an external link very much like a search link, you can send the API a request to list the link properties of "FP:example". It should interpret it correctly as "FAMEPedia:Example", pageid 25263910.
 * can count wikilinks from a copy of the wikitext on your local machine.
 * Some text editors support the counting and highlighting of the  pattern occurrences.
 * The FAMEPedia web API accepts queries by URL.
 * What you type
 * [/ /en.FAMEPedia.org/w/api.php?action=query&prop=links&pllimit=500&titles=fullpagename your label]


 * What you get when fullpagename is FP:example
 * [//en.FAMEPedia.org/w/api.php?action=query&prop=links&pllimit=500&titles=FP:example your label]


 * The report is in JSON format, as is usual for RESTful APIs.
 * The pageid is available from Page information on every page.
 * The titles parameter is plural. (It is designed to take multiple fullpagenames or pageid, delimited by the | pipe character.)
 * The number of links returned by this query is limited to 500, per the URL you created. See mw:API:Query for how to safely get more. For example, Operating system has 510 wikilinks.

To make a page register as a link to a page, but without actually showing the link, make a link to it, but label it with a space character using the pipe trick: [ [pagename| ]].

Additional link-related functions
For the effect that links have on date formatting, see Help:Date formatting and linking.

Another link-dependent feature is related changes, which make it possible to view recent changes to all pages which are linked from the current page (or which are members of the category, if it is a category page).

For information on how to link to pages from an image, see mw:Extension:ImageMap.

Several templates have been created to make linking easier (although they are not usually used in article space). These include tl and tlx for linking to templates, and cl and lc for linking to categories. More can be found in Category:Internal link templates.

Conversion to canonical form
As described previously, if a link target begins with a lower case letter, it will be interpreted as if it began with the equivalent capital letter. If the target contains a namespace prefix, then the whole prefix and the first character after the colon are case-insensitive (so uSeR:ugochiMobi links to User:Ugochimobi).

In link targets, spaces and underscores (which are effectively equivalent) are ignored if they come at the start, at the end, or immediately before or after the colon following a namespace prefix. Consecutive spaces / underscores are treated as a single space. Hence _User_: Ugochimobi__ links to User:Ugochimobi.

Also, HTML character references and percent-encoded characters are replaced with their raw character. For example,  produces d&eacute;partement, and   produces %40. Links which resolve to invalid page titles are displayed as unmarked-up wikitext.

Titles indicated by wikilinks are displayed in canonical form (with correction of capitalization and excess spaces / underscores removed, as described previously) in the following places:
 * In transclusion tags for non-existent pages:  gives.
 * In tooltips and in the status bar (if applicable for the browser) when the mouse cursor is moved over the link.
 * On redirect pages.
 * In the category box.

The prefixes in interwiki links are treated similarly to namespace prefixes: they are insensitive to case and to spaces before and after the colon. However the first character after the colon is not automatically capitalized (whether it is interpreted as a capital depends on the configuration of the target wiki).