Help:Links

From UBC Wiki
Jump to: navigation, search

There are two main types of links that can be created on the the UBC Wiki:

  1. internal links to other pages in the wiki
  2. external links to other websites


Adding links in Visual Editor

VisualEditor - Toolbar - Linking.png

Links can be added through the "Link" icon (links in a chain) in the toolbar, or by using the shortcut Ctrl+K (or ⌘ Command+K on a Mac). If you select (highlight) text and then press the "Link" button, that text will be used in creating the link. For a link that involves only one word, you can either select that word or just put the cursor within that word.

Internal links

VisualEditor-link tool-search results-en.png

When you use either the button or the shortcut, a dialog will open in which you may type the link. The link tool will try to help with internal links by searching for likely matches

VisualEditor link tool 2015.png

Once you have entered or selected the link, you complete the linking process by pressing ↵ Enter or by pressing the Done button. Your link will immediately appear on the page, but as with other changes to the page, it will not be published until you publish the entire page.

External links

VisualEditor-link tool-external link.png

To link to a web page on another website, the process is similar: Choose the "External link" tab, and enter a URL in the box.

VisualEditor link tool simple link.png

External links without labels look like this: 1. You can add these by placing your cursor away from any word (e.g., after a space). Open the link tool by pressing on the button or pressing the shortcut keys. Type the URL in the box, and press the "Done" button to insert the link.

Edit or remove an existing link

VisualEditor-context menu-link tool.png

In order to edit or remove an existing link, press within the text for that link, then press the "Link" icon that appears near it. The dialog will appear, for editing. You can also get to the dialog with the Ctrl+K keyboard shortcut. When a link is selected, it appears as blue framed. In the link editing dialog, you can then change where the link goes. You can also remove the link entirely by pressing the "Remove" button in the upper right corner of the dialog. You can also open the link's target in another window by pressing on the copy of the link in the dialog box. (You might want do this to check if an external link is valid.)

If you want to exit the link label (the text displayed as a link) or continue to write after this link, you can press →:

Pressing it once will escape the link editing dialog and put your cursor at the end of the element linked (blue framed, to edit this element) Pressing it twice will put the cursor after the element linked, ready to type the rest of your text. To edit the link label of an existing link, press within the link label and type the new one. But if you want to replace the entire label, please note:

If you have selected (highlighted) the entire link label, the link will be deleted by typing any key. You may link it from start. To keep the link directly, you may press within that link label, use backspace and delete key without pressing it once more than necessary, and a narrow blue link area will remain there. Now you may type in the new label for the kept link. You can also link to categories, files and more.

Adding links in Wikitext

Internal links

To add an internal link, enclose the name of the page you want to link to in double square brackets. When you save the page, you'll see the new link pointing to your page. If the page exists already it is displayed in blue, if it does not, in red. Selflinks to the current page are not transformed in URLs but displayed in bold. (If you really want to link to the current page, use an anchor (see below), or [[#top|current page]] which always links to the top.)

The first letter of the target page is automatically capitalized, unless otherwise set by the admins, and spaces are represented as underscores (typing an underscore in the link will have a similar effect as typing a space, but is not recommended, since the underscore will also be shown in the text).

Description You type You get
Internal link
[[Main Page]]
Main Page
Piped link
[[Main Page|different text]]
different text
Shortened sort-of-piped link
[[Internationalisation]]s
Internationalisations
Redirect
#REDIRECT [[Main Page]]

See also Help:Redirects

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

Section headings and the top of the page are automatically anchored.

#See also
Internal link to an anchor at another page
[[Help:Formatting#See also]]

If two or more anchors have the same name, add a number, example: #See also2

Help:Formatting#See also
Internal link to the current page's talk page
[[{{TALKPAGENAME}}|Discussion]]
Discussion
Internal link to a subpage
[[/example]]

Shortcut for [[Help:Links/example]]. See also Help:Subpages.

/example
Internal link to a subpage without the leading slash
[[/example/]]

Shortcut for [[Help:Links/example|example]].

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

See also Help:Categories

Category:Help
Direct link to an image, pdf, or other file type (rather than linking to the file page)
[[media:example.jpg]]

[[media:example.pdf]]

See also Help:Adding Media

media:example.jpg

media:example.pdf

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

External links

Description You type You get
External link http://mediawiki.org http://mediawiki.org
External link with different label [http://mediawiki.org MediaWiki] MediaWiki
Numbered external link [http://mediawiki.org] [1]
External links with file icons [http://en.wikipedia.org/wiki/.avi video] [http://en.wikipedia.org/wiki/.ogg sound] [http://en.wikipedia.org/wiki/.pdf document]

Currently supported extensions: ogm, avi, mpeg, mpg (video); ogg, mid, midi, mp3, wav, wma (audio); and pdf (document)

video
sound
document

External link to the same host http://{{SERVERNAME}}/pagename http://wiki.ubc.ca/pagename
External link to other host passing the pagename http://google.com/search?q={{PAGENAMEE}} http://google.com/search?q=Links
Mailto link [mailto:info@example.org email me] email me
Mailto named with subject line and body [mailto:info@example.org?Subject=URL%20Encoded%20Subject&body=Body%20Text info] info

How to avoid auto-links

By default, when you write a URL as is, it will be transformed to an external link.

To avoid that effect, put the URL between <nowiki> tags as in:

<nowiki>http://mediawiki.org</nowiki>

See Also