Help:Links/Wikitext

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.

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 words Community Central. 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.)
[[Community Central:Community Development Team/Requests|]] Community Development Team/Requests (the namespace gets lopped off, but not the subpage)
[[:file:wiki-wordmark.png|]] wiki-wordmark.png (gets rid of the namespace, but not the .png file extension)
[[Forum:Background colors/pictures, HTML|]] Background colors/pictures (removes the namespace and everything after the comma)
[[w:c:parksandrecreation:Leslie Knope|]] c:parksandrecreation:Leslie Knope (pipe trick fails, but link is still valid)

Slash tricks

A slash trick is 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]] = /Wikitext

If you wanted to get rid of the slash at the beginning, then you could type:

[[/Wikitext/]] = Wikitext

Since we're here at Help:Links/Wikitext, the use of a slash trick would refer to the subpages of this subpage:

[[/page doesn't exist/]] = page doesn't exist or Help:Links/Wikitext/page doesn't exist

Advanced linking

Linking to a category or image

When linking to a category for demonstrative purposes rather than for categorizing a page, or if you want to link to an image file page without the actual image showing, put a colon after the double opening square brackets, like this: [[:Category:Browse]] which will look like this: Category:Browse, and [[:File:Wiki-wordmark.png]] will look like this: File:Wiki-wordmark.png.

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 get link to section on currently viewing page, you can skip page name and start with hash symbol followed by section name, for example, [[#Linking_to_a_page_section]] which will produce: #Linking_to_a_page_section that links to this section. Clicking that kind of links wouldn't reload the page.

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. So, for example, [[File:Wiki-wordmark.png|thumb|center|Click the image|link=Help:Contents]] makes:

Wiki-wordmark.png
Click the image

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 pipe side of your link.

Using source mode, this means that if you were to, for example, make a link to Help:Contents green, you would write [[Help:Contents|<span style="color: green;">Help:Contents</span>]] which will look like: Help:Contents.

See also

Further help and feedback

Community content is available under CC-BY-SA unless otherwise noted.