Help:Links

From Gentoo Wiki
Jump to:navigation Jump to:search

There are four kinds of links in MediaWiki:

  1. internal links to other pages in the same wiki
  2. external links to other websites
  3. interwiki links to other websites specifically registered as possible link targets
  4. interlanguage links to other websites registered as other language versions of the same wiki

This wiki does not use the fourth type of link, since we handle multiple languages differently.

Internal links

"Link" template

Use the {{Link}} template to link to other pages or sections of pages. See Help:Translating#For_Editors:_Marking_translatable_sections for more information.

What is typed What is shown
{{Link|Kernel}} Kernel
the {{Link|Kernel|kernel}} the kernel
see {{Link|Kernel|section=#Configuration}} see Kernel
see {{Link|Kernel|section=#Configuration|Kernel configuration}} see Kernel configuration

{{Link|Kernel#Configuration}} is invalid and creates extra work for translators.

Mediawiki links

Note
These links should generally not be used on the Gentoo wiki, the {{Link}} template from the preceding section being preferred.

An internal link (from a "source" page to a "target" page on the same wiki) is formed by enclosing the name of the desired target page in [[double square brackets]]. If it is awkward to use the actual page title at that point in the source page text, a piped link can be used (see examples below).

When the source page is previewed or saved, the new link will be visible. If the target page already exists on this wiki, it will appear blue (or purple, if the page has already been visited by the reader); if not, it will appear red. (Following a "redlink" will bring up the page editor in which the page can be created. For more information about editing and creating pages, please see the other Help pages.)

Note that "selflinks", in which the source and target pages are the same, are not shown as links but instead displayed in bold. To link to a particular place (i.e., a section heading) in the current page, use an "anchor" (see below), or use [[#top|current page]], which always links to the top of the page.

Note that the first letter of the target page is case-insensitive (it is automatically capitalized in page titles but can be upper- or lower-case in links), and that spaces can be represented as underscores (typing an underscore in a link is equivalent to typing a space, but is not recommended, except possibly in piped links, since the underscore will be visible to the reader).

Description Type To get
Internal link
[[Main Page]]

Main Page

Piped link
[[Main Page|different text]]
[[Main_Page|different text]]

See also Help:Piped link on meta.wikimedia.org.

different text

different text

Internal link to pagename with leading slash
[[:/etc/portage]]

/etc/portage

Hide namespace shortcut
[[Help:Contents|]]

Short for [[Help:Contents|Contents]] (expanded in page source when saved).

Contents

Word-ending links
[[Help]]s
[[Help]]ing
[[Help]]ers

Helps

Helping

Helpers

Avoiding word-ending links
[[Help]]<nowiki />ful advice
[[Wikipedia:GNU General Public License|GPL]]<nowiki />v3

Helpful advice

GPLv3

Page title redirect
#REDIRECT [[Main Page]]

See Help:Redirects.

Main Page

Internal link to an anchor
[[#See also]]

Section headings and the [[#top]] of the page are automatically anchored.

#See also

Piped internal link to anchor
[[#See also|different text]]

different text

Setting internal link anchor target
<div id="UniqueAnchorName">optional text</div>
<span id="AnotherUniqueAnchorName">optional text</span>

Allows [[Help:Links#UniqueAnchorName]]; omit "optional text" for an invisible anchor.

optional text


optional text

Internal link to anchor in another page
[[Help:Images#See also]]

Help:Images#See also

Internal link to current page's talk page
[[{{TALKPAGENAME}}|Discussion]]

See also Help:Magic words.

Discussion

Internal link to subpage of current page
[[/example]]

Shorter version of [[Help:Links/example]] when used on the page Help:Links. See also Help:Subpages.

/example

Internal link to subpage hiding leading slash
[[/example/]]

Shorter version of [[Help:Links/example|example]] when used on the page Help:Links.

example

Internal link to category page
[[:Category:Help]]

Note that the leading colon is required; see Help:Categories.

Category:Help

Internal link to image or file of other type
[[Media:Example.jpg]]
[[Media:Larry-hi.png]]

See also Help:Images.

Media:Example.jpg

Media:Larry-hi.png

Internal link to the reader's user page
[[Special:MyPage]]

Special:MyPage

Internal link to translated article
[[Special:MyLanguage/Kernel|Kernel]]

Target as per Language settings in preferences (otherwise target would be in English).

Kernel

Linking to a specific page edit
[[Special:Diff/1370/1371|diff]]

See also Help:Tracking changes.

diff

Redlinks

Internal links to nonexistent pages show up as redlinks. These can be used to create a new page.

Links that lead to nowhere are not that useful, especially if they hang around for a long time. If there seems like a need for a link to a page that doesn't exist, consider creating the page!

If a page on a certain subject would be useful, but the editor doesn't have the time or resources to create it, consider adding it to the requested artlcles list, rather than making a redlink.

Mediawiki keeps track of redlinks here: Special:WantedPages.

External links

An external link (to a "target" page on another website) is formed by enclosing the URL of the desired target page in [single square brackets]. If no other text is specified, the link is shown as a bracketed number; however, this is discouraged in favor of the equivalent of a piped link, which in this case is accomplished by simply separating the normal "link text" from the URL with a space (see examples below).

When the source page is previewed or saved, the new link will be visible followed by a small icon to indicate that the reader will leave the current wiki if they follow the link. Unlike with internal links, an external link will look the same whether or not the target page actually exists.

If the target website can be browsed in secure HTTP, it is preferable to omit the "https:" portion of the URL.

Description Type To get
Bare external link
http://mediawiki.org
https://mediawiki.org

Requires "http:" or "https:".

http://mediawiki.org

https://mediawiki.org

Avoiding link on bare URL
<nowiki>http://mediawiki.org</nowiki>

http://mediawiki.org

Protocol-relative URL
[//mediawiki.org MediaWiki]

Uses secure HTTP if current page is using it.

MediaWiki

External link with different text
[//mediawiki.org MediaWiki]

MediaWiki

Numbered external link
[//mediawiki.org]

Autonumbered sequentially on each page.

[1]

External links with file icons
[//commons.wikipedia.org/wiki/File:Orion.ogv video]
[//commons.wikipedia.org/wiki/File:Linux.ogg sound]
[//commons.wikipedia.org/wiki/File:Think_Python.pdf document]

See External link icons below for currently supported file extensions and their icons.

video

sound

document

External link to same host
https://{{SERVERNAME}}/pagename

See also next section; this and the next example use the bare-URL form merely for clarity.

https://wiki.gentoo.org/pagename

Passing the current pagename in an external link
https://google.com/search?q={{PAGENAMEE}}
https://google.com/search?q={{FULLPAGENAMEE}}

Note the final E, which indicates the URL-encoded page title.

https://google.com/search?q=Links

https://google.com/search?q=Help:Links

Mailto link
[mailto:info@example.org email me]

email me

Mailto with subject line and body
[mailto:info@example.org?subject=Subject%20line&body=Body%20text label]

Subject and body must be URL-encoded; might not work for everyone.

label

External links to internal pages

Linking to a wiki page whose URL contains parameters (set off by ? and &) is most easily accomplished using an external link.

Description Type To get
Providing external link to edit a page
[//wiki.gentoo.org/index.php?title=Help:Links&action=edit Edit]

Edit

Same using a parser function to refer to the current page
[{{fullurl:{{FULLPAGENAMEE}}|action=edit}} Edit]

See also the help on page-name variables and parser functions.

Edit

Same styled to look like internal link
<span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=edit}} Edit]</span>

See Manual:Plainlinks at the MediaWiki wiki.

Edit

External link icons

If the link uses a special protocol or its target is a special kind of file (based on the file extension in the URL), it may be marked with a special icon (instead of the default showing an arrow).

Test link Icon Trigger
[2] external-link-ltr-icon.png .external, http://, gopher://
[3] lock-icon.png https://
[4] mail-icon.png mailto:
[5] news-icon.png news://
[6] file-icon.png ftp://
[7] talk-icon.png irc://
[8] audio-icon.png .ogg, .mid, .midi, .mp3, .wav, .wma
[9] video-icon.png .ogm, .ogv, .avi, .mpeg, .mpg
[10] document-icon.png .pdf, .pdf#, .pdf?

Interwiki links

Interwiki links are internal-style links to external websites that have been registered in advance as useful targets for outgoing links. The most well known such site is the English Wikipedia.

Unlike other internal links, interwiki links do not rely on page existence detection, so an interwiki link will look the same whether the target page exists or not.

Description Type To get
Interwiki link to Acronym Finder
[[acronym:GLEP]]

acronym:GLEP

Same using alternate link text
[[acronym:GLEP|GLEP]]

For other variations, see Internal links above.

GLEP

The {{Wp}} template exists for stylized links to Wikipedia pages:

Description Type To get
Interwiki link to English Wikipedia article
{{Wp|Gentoo Linux}}

Gentoo Linux

Interwiki link to Wikipedia article in other language
{{Wp|de:Gentoo Linux}}

Uses (mostly) ISO language codes.

de:Gentoo Linux

Same using alternate link text
{{Wp|de:Gentoo Linux|German}}

For other variations, see Internal links above.

German

Interlanguage links

Interlanguage links (in which the target is a page in a different language hosted at an entirely different wiki) are not used on the Gentoo Linux wiki. Instead the Translate extension is used to maintain pages in languages other than English. Please see the Gentoo Wiki:FAQ for more information.

Whatlinkshere

For including a section of pages linking to the present page, use the {{Whatlinkshere}} transclusion. This appears useful within noinclude tags for pages transcluded to others.

<noinclude>
What links here:
{{Special:Whatlinkshere/Help:Links|namespace=Help}}
</noinclude>

See also

  • See also sections - wiki guidelines on including a section in articles to reference related pages

External references