Links: Difference between revisions
No edit summary |
Gerald Chi (talk | contribs) mNo edit summary |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | |||
{{CMG}} | |||
== | ==Overview== | ||
The words in blue in WikiDoc are hyperlinks, and they allow users to move between pages. | |||
There are two general types of hyperlinks in WikiDoc: | |||
#'''''Internal Links''''' to other pages in WikiDoc: These are also called a '''wikilink''' or an '''internal link''' | |||
#'''''External Links''''' to pages outside of WikiDoc | |||
==Internal Links to other pages in WikiDoc:== | |||
These are also called a '''wikilink''' or an '''internal link''' | |||
You can create a link to a page within WikiDoc by enclosing the word inside tow square brackets like this: | |||
Typing this: | |||
<nowiki>[[ST Elevation Myocardial Infarction]]</nowiki> | |||
Yields this: | |||
[[ST Elevation Myocardial Infarction]] | |||
===What if I want alternate text to appear instead of the text that leads to the page I am linking to?=== | |||
For example, if you want to use the word heart attack in a page instead of ST Elevation Myocardial Infarction, but you want the text of heart attack to go to ST Elevation Myocardial Infarction? | |||
In this case you use what is called a "piped link" because it uses the symbol |. | |||
Typing this: | |||
<nowiki>[[ST Elevation Myocardial Infarction|heart attack]]</nowiki> | |||
Yields this: | |||
[[ST Elevation Myocardial Infarction|heart attack]] | |||
The word heart attack appears, but you end up at ST Elevation Myocardial Infarction. | |||
== | ==External Links to pages outside of WikiDoc== | ||
[ | External links link directly to any webpage outside of WikiDoc. | ||
[ | |||
[ | ===What is the Syntax to Make an External Link?=== | ||
For instance, say you want to link to a website named www.exmaple.org. | |||
Typing this: | |||
<code><nowiki>[http://www.example.org link name]</nowiki></code> | |||
Yields this: | |||
[http://www.example.org link name] | |||
CAUTION: | |||
To make this work, you need to separate the name "link name" from the text that precedes it with a space. | |||
===What happens if I don't specify a "link name"?=== | |||
Links without link names will be numbered. | |||
Typing this: | |||
<code><nowiki>[http://www.example.org]</nowiki></code> | |||
Yields this: | |||
[http://www.example.org]. | |||
===What happens if I don't use the square brackets?=== | |||
Links with no square brackets will be displayed in their entirety: | |||
Typing this: | |||
<nowiki>http://www.example.org</nowiki> | |||
Yields this: | |||
http://www.example.org | |||
Unlike in the case of an internal link, <nowiki>[http://www.example.org a]</nowiki> gives [http://www.example.org a]. | |||
===How Do I Get Rid of That Arrow Icon?=== | |||
Monobook skin produces an arrow icon after every external link. This can be suppressed with class="plainlinks": | |||
Typing this the usual way: | |||
http<nowiki>://a</nowiki> | |||
Yields this the usual way with an arrow: | |||
http://a | |||
However, typing this: | |||
<nowiki><</nowiki>span class="plainlinks">http<nowiki>://a</</nowiki>span> | |||
Yields this without the arrow: | |||
<span class="plainlinks">http://a</span> | |||
==Why Are Some Links Black Instead of Blue?== | |||
WikiDoc automatically checks to see if the target of a wikilink exists. If the page doesn't exist, the link is black and the link leads to the editing screen so that the page can be created/edited. | |||
==What if the Page it Links to is Small and What is the "Stub Feature"== | |||
A wikilink to an existing page will be called a 'stub' if the page is not a redirect, '''''and''''' the number of bytes of the wikitext is less than the "threshold for stub display" set in the [[Help:Preferences|user's preferences]]. | |||
This allows users to immediately identify links to very short pages th`at probably need to be expanded. Alternately, a user may set a very high threshold. | |||
==What if I want to Link Directly to a Section or Subsection of a Page Rather than to the top of the Page? What is "Section linking (anchors)" == | |||
You type the following to go to a section named "conclusion" in a page named "page name" and call it "in the conclusion" | |||
<nowiki>[[page name#conclusion|in the conclusion]] | |||
</nowiki> | |||
Links in the form <code><nowiki>[[#anchor_name]]</nowiki></code> will link to any anchor named "anchor_name" on the page. This may be either a heading named "anchor_name", or an arbitrary position. <code><nowiki>[[#top]]</nowiki></code> is a reserved name that links to the [[#top|top of a page]]. It is possible to create an arbitrary anchor name using the HTML code <code><nowiki><span id="anchor_name"></span></nowiki></code>. | |||
Anchor links can also be appended to any type of link; for more information, see [[Help:Section#Section_linking]]. | |||
Here is an example: | |||
Typing this: | |||
<nowiki>[[Cervix#Cervical mucus|cervical mucus]] | |||
</nowiki> | |||
Yields this: | |||
[[Cervix#Cervical mucus|cervical mucus]] | |||
== Miscellaneous == | |||
=== Linking to a page with images === | |||
It is possible to use images as links to other pages. For more information, see [[Help:Navigational images|use an image as a link to a page]]. | |||
=== "Hover box" on links === | |||
On some browsers, holding the cursor over link will show a hover box containing the text of the link's HTML title attribute. MediaWiki sets this to the target page name (without the possible 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 info, but with the possible section indication, in the address bar. | |||
For these effects a piped link is useful even if it not followed; for example, for displaying the meaning of an acronym (e.g. [[neutral point of view|NPOV]]) or any other remark. It is possible to produce a hover box without a link, see {{tim|H:title}}. | |||
=== Disallowed characters === | |||
In internal and interwiki link style, a plus sign in a page name is not allowed, the HTML and hence the rendered page just shows the wikitext, e.g. [[a+b]]. In external link style a plus sign in the URL is retained. It is often equivalent with a space. See also below. | |||
In accordance with the rules explained in [[Help:Page name]], 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 will 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. | |||
=== Special pipe syntax === | |||
Using an empty pipe syntax on wiki and interwiki links will hide interwiki prefixes and parentheses. For example, <nowiki>[[w:Mercury (planet)|]]</nowiki> becomes [[w:Mercury (planet)|Mercury]]. This pipe syntax should only be used where the unqualified reference is not ambiguous, such as in an article about the solar system. See [[Help:Piped link]]. | |||
=== Additional effects of links === | |||
*[[Help:Related changes|Related changes]] | |||
*[[Help:What links here|Backlink]]s | |||
*[[Help:Preferences#Date_format|Date format]] | |||
* Using a space after the pipe syntax (<nowiki>[[Main page| ]]</nowiki>) produces (perhaps depending on the browser) a space only, not a link ("[[Main page| ]]"), but it is treated as a link for the "what links here" feature. | |||
===Links from a page=== | |||
With [[query]] the links from page ''pagename'', sorted by namespace, and for each namespace alphabetically, are given by <nowiki>{{SERVER}}{{SCRIPTPATH}}</nowiki>/query.php?what=links&titles=''pagename'' , e.g. {{SERVER}}{{SCRIPTPATH}}/query.php?what=links&titles={{FULLPAGENAME}} . | |||
==See also== | |||
*[[Help:Piped link]] | |||
*[[Help:Template#Restrictions]] (and the next section) | |||
[[Category:Help]] | |||
{{WikiDoc Help Menu}} | |||
{{WikiDoc Sources}} |
Latest revision as of 14:38, 2 September 2013
Editor-In-Chief: C. Michael Gibson, M.S., M.D. [1]
Overview
The words in blue in WikiDoc are hyperlinks, and they allow users to move between pages.
There are two general types of hyperlinks in WikiDoc:
- Internal Links to other pages in WikiDoc: These are also called a wikilink or an internal link
- External Links to pages outside of WikiDoc
Internal Links to other pages in WikiDoc:
These are also called a wikilink or an internal link
You can create a link to a page within WikiDoc by enclosing the word inside tow square brackets like this:
Typing this:
[[ST Elevation Myocardial Infarction]]
Yields this:
ST Elevation Myocardial Infarction
What if I want alternate text to appear instead of the text that leads to the page I am linking to?
For example, if you want to use the word heart attack in a page instead of ST Elevation Myocardial Infarction, but you want the text of heart attack to go to ST Elevation Myocardial Infarction?
In this case you use what is called a "piped link" because it uses the symbol |.
Typing this:
[[ST Elevation Myocardial Infarction|heart attack]]
Yields this:
The word heart attack appears, but you end up at ST Elevation Myocardial Infarction.
External Links to pages outside of WikiDoc
External links link directly to any webpage outside of WikiDoc.
What is the Syntax to Make an External Link?
For instance, say you want to link to a website named www.exmaple.org.
Typing this:
[http://www.example.org link name]
Yields this:
CAUTION: To make this work, you need to separate the name "link name" from the text that precedes it with a space.
What happens if I don't specify a "link name"?
Links without link names will be numbered.
Typing this:
[http://www.example.org]
Yields this:
[2].
What happens if I don't use the square brackets?
Links with no square brackets will be displayed in their entirety:
Typing this:
http://www.example.org
Yields this:
Unlike in the case of an internal link, [http://www.example.org a] gives a.
How Do I Get Rid of That Arrow Icon?
Monobook skin produces an arrow icon after every external link. This can be suppressed with class="plainlinks":
Typing this the usual way:
http://a
Yields this the usual way with an arrow:
However, typing this:
<span class="plainlinks">http://a</span>
Yields this without the arrow:
Why Are Some Links Black Instead of Blue?
WikiDoc automatically checks to see if the target of a wikilink exists. If the page doesn't exist, the link is black and the link leads to the editing screen so that the page can be created/edited.
What if the Page it Links to is Small and What is the "Stub Feature"
A wikilink to an existing page will be called a 'stub' if the page is not a redirect, and the number of bytes of the wikitext is less than the "threshold for stub display" set in the user's preferences.
This allows users to immediately identify links to very short pages th`at probably need to be expanded. Alternately, a user may set a very high threshold.
What if I want to Link Directly to a Section or Subsection of a Page Rather than to the top of the Page? What is "Section linking (anchors)"
You type the following to go to a section named "conclusion" in a page named "page name" and call it "in the conclusion"
[[page name#conclusion|in the conclusion]]
Links in the form [[#anchor_name]]
will link to any anchor named "anchor_name" on the page. This may be either a heading named "anchor_name", or an arbitrary position. [[#top]]
is a reserved name that links to the top of a page. It is possible to create an arbitrary anchor name using the HTML code <span id="anchor_name"></span>
.
Anchor links can also be appended to any type of link; for more information, see Help:Section#Section_linking.
Here is an example:
Typing this:
[[Cervix#Cervical mucus|cervical mucus]]
Yields this:
Miscellaneous
Linking to a page with images
It is possible to use images as links to other pages. For more information, see use an image as a link to a page.
"Hover box" on links
On some browsers, holding the cursor over link will show a hover box containing the text of the link's HTML title attribute. MediaWiki sets this to the target page name (without the possible 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 user preferences. The browser may also show similar info, but with the possible section indication, in the address bar.
For these effects a piped link is useful even if it not followed; for example, for displaying the meaning of an acronym (e.g. NPOV) or any other remark. It is possible to produce a hover box without a link, see Template:Tim.
Disallowed characters
In internal and interwiki link style, a plus sign in a page name is not allowed, the HTML and hence the rendered page just shows the wikitext, e.g. a+b. In external link style a plus sign in the URL is retained. It is often equivalent with a space. See also below.
In accordance with the rules explained in Help:Page name, conversions are automatically made to non-literal characters in wiki and interwiki links. For example, "[[Help:Page%20name]]
" becomes "Help:Page name". However, the opposite is true for external links; literal characters are converted into non-literal characters. For example, most browsers will 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.
Special pipe syntax
Using an empty pipe syntax on wiki and interwiki links will hide interwiki prefixes and parentheses. For example, [[w:Mercury (planet)|]] becomes Mercury. This pipe syntax should only be used where the unqualified reference is not ambiguous, such as in an article about the solar system. See Help:Piped link.
Additional effects of links
- Related changes
- Backlinks
- Date format
- Using a space after the pipe syntax ([[Main page| ]]) produces (perhaps depending on the browser) a space only, not a link (" "), but it is treated as a link for the "what links here" feature.
Links from a page
With query the links from page pagename, sorted by namespace, and for each namespace alphabetically, are given by {{SERVER}}{{SCRIPTPATH}}/query.php?what=links&titles=pagename , e.g. https://www.wikidoc.org/query.php?what=links&titles=Links .
See also
- Help:Piped link
- Help:Template#Restrictions (and the next section)