Jump to content

Help:Link: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m Reverted edits by Reliser (talk) to last version by Kwamikagami
Replaced content with 'lololo'
Line 1: Line 1:
lololo
{{Merge from|Help:Piped link}}
[[File:How to link text.ogv|thumb|300px|A video screencast showing how to create links]]
This page contains technical help on making [[hyperlink]]s in Wikipedia, giving readers one-click access to other Wikipedia pages, other Wikimedia projects and external websites. For very basic information, see the [[Wikipedia:Cheatsheet|Cheatsheet]]. For guidelines on how links should be used in Wikipedia, see [[Wikipedia:Manual of Style (linking)]].

== Wikilinks ==
A '''wikilink''' or '''internal link''' links a page to another page within English Wikipedia.
*<nowiki>[[a]]</nowiki> gives [[a]] (link to a, labeled a).
*<nowiki>[[a|b]]</nowiki> gives [[a|b]] (link to a, labeled b). To learn how to type the vertical bar ("pipe" symbol) see [[Wikipedia:Piped link]]
*<nowiki>[[a]]b</nowiki> gives [[a]]b, just like <nowiki>[[a|ab]]</nowiki> does: [[a|ab]].
*<nowiki>[[a|b]]c</nowiki> gives [[a|b]]c, just like <nowiki>[[a|bc]]</nowiki> does: [[a|bc]].
*<nowiki>[[a]]:b</nowiki> gives [[a]]:b (''punctuation'' is not appended to the link). The same goes for <nowiki>[[Washington]]'s</nowiki> or <nowiki>e-[[mail]]</nowiki>.
*<nowiki>a[[b]]</nowiki> gives a[[b]].
*<nowiki>[[a]]<</nowiki>nowiki>b</nowiki> gives [[a]]<nowiki>b</nowiki>.
*<nowiki>[[a]]''b''</nowiki> gives [[a]]''b''.
*<nowiki>''[[a]]''b</nowiki> gives ''[[a]]''b.
*<nowiki>[[a|b]]c<</nowiki>nowiki>d</nowiki> gives [[a|b]]c<nowiki>d</nowiki>.

Links with a specified label are said to be "[[Help:Piped link|piped]]" because of the pipe symbol used ( | ). For certain types of link, the label will be generated automatically if a pipe is typed with no label after it (thus saving you typing). See [[Help:Pipe trick]].

The link target is '''case-sensitive except for the first character''' (so [[atom]] links to [[Atom]], but [[ATom]] does not). Other ways in which link targets are reinterpreted are described below under [[#Conversion to canonical form|Conversion to canonical form]].

If the target of a wikilink does not exist, it is displayed red, and is called a [[Wikipedia:Red link|red link]]. If a red link is clicked, the user is taken to a page where it is possible to create a page under the redlinked title. Red links to a particular (non-existent) title can be detected using the [[Help:What links here|What links here]] feature.

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

Attempting to link normally to an [[Wikipedia:Images|image]] page, [[Wikipedia:Categorization|category]] page or [[Help:Interlanguage links|interlanguage link]] will produce a different effect: it will 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, add an initial colon, as in <code><nowiki>[[:File:Mediawiki.png]]</nowiki></code>, <code><nowiki>[[:Category:Help]]</nowiki></code>, <code><nowiki>[[:fr:Help:Link]]</nowiki></code>.

== Interwiki links ==
An ''[[Help:Interwiki linking|interwiki link]]'' links to a page on another Wikimedia project website, such as [[Meta-Wiki|Meta]] or another language Wikipedia. The target site must be on the [[m:Interwiki map|interwiki map]] specified for the source wiki. These links have the same <nowiki>[[...]]</nowiki> syntax as wikilinks (see above), but take a prefix which specifies the target site. For example, <nowiki>[[m:Help:Link]]</nowiki> links to the "Help:Link" page on Meta. Links can be piped as with wikilinks. Remember that an [[Help:Interlanguage links|interlanguage link]] should be preceded by a colon if it is to be displayed where it appears in the text; otherwise it will be listed at the side of the page (which is appropriate only if it is the most closely corresponding page in the other language Wikipedia).

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

== External links ==
External links use absolute [[URL]]s to link directly to any webpage. These links have the associated CSS class "external". External links are in the form <code><nowiki>[http://www.example.org link name]</nowiki></code> (resulting in [http://www.example.org link name]), with the link name separated from the URL by a space. Links without link names appear numbered: <code><nowiki>[http://www.example.org]</nowiki></code> becomes [http://www.example.org]. Links with no square brackets display in their entirety: http://www.example.org .

See [[Help:URL#Linking to URLs|Linking to URLs]] for more detailed information.

[[Special:LinkSearch]] finds all pages linking to a given site.

The external link syntax can also be used to link to particular page versions within Wikipedia that are not accessible by wikilinks, such as page [[WP:History|history]], edit view, an old version of a page, the [[WP:Diff|diff]] between two versions, etc. It can also be used to create a [[Help:Navigational image|navigational image]].

To display a link without the arrow icon, place the external link syntax between
<tt>&lt;span class="plainlinks">...&lt;/span></tt> tags.

== Section linking (anchors) ==
{{shortcut|WP:ANCHOR}}
<!--Not very helpful...
To make a link to a section of a page, use the following syntax:
*<nowiki>[[#B1]]</nowiki> where B1 is B with blanks replaced by underbars, links to the section titled "B" on the current page (for example, [[#External_links]] links to the External links section on this page).
*<nowiki>[[A#B1]]</nowiki> where B1 is B with blanks replaced by underbars, links to the section titled "B" on page "A".
-->

To link to a section in the same page you can use: <tt><nowiki>[[#section name|displayed text]]</nowiki></tt>, and to link to a section in another page: <tt><nowiki>[[page name#section name|displayed text]]</nowiki></tt>.

The section title in fact points to an anchor on the target page. It is possible to define anchors other than explicit section titles, using the HTML code <code><nowiki><span id="anchor_name">...</span></nowiki></code>, or the template <code><nowiki>{{Anchor|anchor name}}</nowiki></code> (see {{tl|Anchor}} syntax). However <code><nowiki>[[#top]]</nowiki></code> and <code><nowiki>[[#toc]]</nowiki></code> are reserved names that link to the top of a page and the table of contents, respectively.

Section links still work if the wikilink is a [[Help:Redirect|redirect]] (for example, if [[Danzig]] redirects to [[Gdańsk]], then [[Danzig#History]] will link to the "History" section of [[Gdańsk]]). It is also possible to put section links inside redirects (these work only if [[JavaScript]] is enabled). For example, [[Wikipedia:Section link]] redirects to [[Help:Link#Section linking (anchors)]]. Note that an explicit section link overrides any section link in a redirect, so [[Wikipedia:Section link#Interwiki links]] will go to the "Interwiki links" section of this page.

For more information, see [[Help:Section]]. See also [[WP:TARGET]].

Anchor links can also be added to external URLs and to interwiki links, again using the # syntax. Note that if the page name is automatically converted, then the section link still works, but disappears from the address bar (this makes it more difficult to bookmark the section itself).

==Subpage links==
In a namespace in which the [[Help:Subpage|subpage]] feature is enabled (which does ''not'' include Wikipedia article space), the following relative links can be used:
* <nowiki>[[../]]</nowiki> links to the parent of the current subpage, e.g., on A/b it links to A, on A/b/c it links to A/b.
* <nowiki>[[../s]]</nowiki> links to a sibling of the current subpage, e.g., on A/b, it links to A/s.
* <nowiki>[[/s]]</nowiki> links to a subpage, e.g. on A it is the same as <nowiki>[[A/s]]</nowiki>.

More details can be found at [[m:Help:Link#Subpage feature]].

==ISBN, RFC and PMID automatic links==
Links to these items are generated automatically, with no need to insert square brackets:
*[[Wikipedia:ISBN|ISBN]] codes automatically generate links, for example: the wikitext <code><nowiki>ISBN 978-0-12-345678-9</nowiki></code> becomes ISBN 978-0-12-345678-9 which corresponds to [[Special:Booksources/9780123456789]].
*<code><nowiki>RFC 4321</nowiki></code> becomes RFC 4321, which is the external link to the standard at: <code><nowiki>http://tools.ietf.org/html/rfc4321.</nowiki></code>
*<code><nowiki>PMID 12345678</nowiki></code> becomes PMID 12345678, which links to a reference in the medical literature at [[PubMed]].
To prevent such automatic linking, use &lt;nowiki>...&lt;/nowiki> tags around the text.

==Changing link appearance==
The ways that various links are displayed in browsers, as described above, are the default display styles in the default [[WP:Skin|skin]]. Users can change the way they see links:
*by selecting a different skin;
*by applying a [[Help:User style|user style]] using CSS;
*by changing the "Underline links" or "Format broken links like this" value on the Appearance tab of [[Help:Preferences|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 boxes ==
In many browsers, holding the cursor over a link ([[mouseover]]) shows a hover box ([[tooltip]]) containing the text of the link's HTML title attribute. MediaWiki 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 URL if it's an external link. (This can be switched off in the [[Help:Preferences|user preferences]].) The browser may also show similar information, including any section indication, in the address 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 box without a link, using the {{tl|H:title}} template.

== Disallowed characters ==
A link whose target contains disallowed characters (see [[WP:Page name]]) will be displayed without markup, as in [[A{b}]].

Conversions are automatically made to [[Help:Special characters|non-literal characters]] in wiki and interwiki links. For example, "<code><nowiki>[[Help:Page%20name]]</nowiki></code>" becomes "[[Help:Page name]]". However, the opposite is true for external links; literal characters are converted into non-literal characters. For example, most browsers convert ".../wiki/!" to ".../wiki/%21".

A code like %70 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 <tt>&action=edit</tt> or <tt>&redirect=no</tt> 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 <tt>action=edit</tt> to the URL query string:
[{{fullurl:{{{1}}}|action=edit}} {{{1}}}]

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.

== Links to and from a page ==
To list pages which link ''to'' the current page (backlinks), use the [[Help:What links here|What links here]] feature. The {{tl|orphan}} tag can be placed on pages with few incoming links.

To make the current page show up at "What links here" for a certain other page without creating a working link to that other page, use a link with a space following the pipe, as in <nowiki>[[Main page| ]]</nowiki>.

To list all pages which are linked ''from'' a particular page, enter the following URL, using the page title (with spaces replaced by underscores) in place of PAGENAME:
<pre>http://wiki.riteme.site/w/api.php?action=query&prop=links&pllimit=500&titles=PAGENAME</pre>
The number of links returned is limited to 500.

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

Another link-dependent feature is [[Help:Related changes|Related changes]], which makes 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|tl}} and {{tl|tlx}} for linking to templates, and {{tl|cl|}} and {{tl|lc}} for linking to categories. More can be found in [[:Category:Internal link templates]].

==Conversion to canonical form==
As described above, 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 [[Help:Namespace|namespace]] prefix, then the whole prefix and the first character after the colon are case-insensitive (so [[uSeR:jimbo Wales]] links to [[User:Jimbo Wales]]).

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_: Jimbo_ __ Wales__]] links to [[User:Jimbo Wales]].

Also, [[HTML character reference]]s and [[percent encoding|percent-encoded]] characters are replaced with their raw character. For example, <tt><nowiki>[[d&amp;eacute;partement]]</nowiki></tt> produces [[d&eacute;partement]], and <tt><nowiki>[[%40]]</nowiki></tt> produces [[%40]]. Links which resolve to [[Help:Page name#Invalid page names|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 above) in the following places:
*in [[Help:Transclusion|transclusion]] tags for non-existent pages: <tt><nowiki>{{qwsazx}}</nowiki></tt> gives {{qwsazx}};
*in pop-ups and on the status bar (if applicable for the browser) when the mouse cursor is moved over the link;
*on [[Help:Redirect|redirect]] pages;
*in the [[WP:Category|category]] box.

The prefixes in [[Help:Interwiki linking|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).

== See also ==
*[[mw:Help:Links|MediaWiki help page on links]]
*[[:Category:External link templates|Category:External link templates]]

[[Category:Wikipedia link help]]

[[ar:عبدالله فؤاد]]
[[ko:위키백과:링크]]

Revision as of 16:41, 27 April 2011

lololo