MediaWiki Notes

From BrycesWiki
Jump to navigationJump to search

This page is for my notes on MediaWiki. Much of the content can be found in the book MediaWiki by Daniel J. Barrett


Namespaces determine the type of content. The Help namespace leads to help pages, which are either the defaults that come with MediaWiki or customized by the users. The Talk namespace takes users to the discussion page of any particular source, depending on how it is typed in the search field.

User talk:UserName

will lead to the talk page of a particular user.

The Category namespace goes to or creates categories, which can be used to organize content, much like how I organized the wiki.

Other Namespaces exists, so these are just a few of them.


Just like webpages in HTML, there are three different kinds of links.

Links can be one of the following

  • internal links
  • external links
  • Graphical Links

Just like many other types of websites, it is not advisable to make everything a link.

For sensible advice on when to create links, visit either of the following:

Internal Links

Internal links in MediaWiki go to other entries on the wiki.

[[Article Name]]

Creates a link to a wiki entry on the server with the name of the article as the link's text.

[[Article Name | Link Text]]

Like the former, it creates a link to a wiki entry on the server, but the link text will be whatever is specified.

Anchor Links

Another are type of internal links, but also applies to external links, depending on how it is used, are anchor links. Just like HTML, these are preceded by a symbol. In fact, the symbols are exactly the same. These kind of links go to either a section of the current wiki article or a section of an external wiki article.

[[#Heading Name]]

This example creates a link to section in the currently viewed article.

[[Article#Heading Name]]

This example creates a link to section of another wiki article on the wiki.

External Links

External links in MediaWiki work similar to external links in webpages, just like internal links are kind of similar to internal links on websites. 

creates a link to the address specified using the actual address as the link text.

[ Link Text]

creates a link to the specified address using specified text as the link text.

In the event that the wiki site should need to display an external link, do not hard code it. Instead, use either of the following methods


This code gets the server address that the site was accessed from and uses it in the URL.


It is the same as above, but it includes the protocol.

[{{fullurl:Article Name | querystring(optional)}}]

The above example display the full url of a page with the use of querystrings added, if the user chooses.

Interwiki Links

An interwiki link is a link to an outside wiki, such as the well-known Wikipedia.

Adantages of interwiki links, compared to regular external links include:

  • Shorter to type
  • Have the same appearance as Internal links
  • easier to maintain

The above links to an article on Wikipedia.

Some prefixes are included with MediaWiki by default.

Administrators can specify other interwiki prefixes.

File Links

File links are links to files on the user's computer. By default, MediaWiki does not support file links.


This links to a file in a certain user's folder on Linux systems.


This links to a file on Windows systems


This leads to a file on a Samba file server.

Graphical Links

Graphical links should have an obvious definition, as people have seen them countless times. However, to make things not so confusing, I will just say that they are link that are images, such as buttons, arrows, photos, etc.

 <span class="plainlinks">[]</span>

The above example create a graphically link from an external image, if the user is allowed to embed external images.


Images on MediaWiki work a bit differently to how they work in HTML, as there are different operations than just linking to or displaying an image.


will embed an image into the page and make that image a link to the image page. In HTML, however, embedding the image will not make it a link.


Will not embed the image and instead creates a link to the image, working much like how normal links act.


will create a link directly to the file, where it would either download or display the image. In HTML, one would need to specify the path to the image as a link.

[[Image:File.png|Hello World!|50px|border|right]]

Images can have options, just like HTML has image attributes and can be aligned using CSS. The example above gives it alternate text, scales it to a width of 50 pixels, draws a border around the image, and places it on the right portion of the page.


this displays the full path of an image located on a wiki. It also acts similar to external links.


Just like HTML, there are three different types of lists. People should be familiar with what they are, as everyone has encountered them in one way or another.

  • Bulleted lists
  • Numbered Lists
  • Definition Lists

Bulleted Lists

Bulleted lists, like the ones that can be seen throughout this article, are simple to create.

*Item 1
*Item 2
*Item 3

The above example will create a list of three items.

Another similarity to HTML is that items can be nested.

*Item 1
**Item 1, part 2
**Item 1, part 3
*Item 2
**Item 2, part 2
***Item 2, part 2, section 1
***Item 2, part 2, section 2

This create a list of two items. One item has two nested item. On the other hand, the second item contains only one nested item, which itself contains two nested items.

At any time, if a portion of an item is on the next line, insert a colon after the appropriate amount of asterisks.

Numbered Lists

Numbered lists follow pretty much the same pattern as bulleted lists, but there is one difference.

#Item 1
#Item 2
#Item 3

This creates a numbered list. As for a nested list, it is the same method as a bulleted list, but using the symbol presented in the example.

In the opinion of the author of MediaWiki from O'Reilly Media, as well as my own opinion, being from an HTML background, the use of the HTML tag equivalent for numbered lists is much more suited for complex situations.

In HTML, such a list will be created by this:

<li>Item 1
<li>Nested Item 1</li>
<li>Item 2</li>
<li>Item 3</li>

Using the above example, a user can specify how the list would look (i.e. use Roman numerals instead of Arabic numerals). Daniel also specifies that it is much easier to keep things together, as things get more complex.

Definition Lists

Definition lists are a list of terms and their definition. In HTML, I find this type of list, in combination with numbered lists, to look really good for a page like an FAQ, even though that is not its purpose.

; Item 1: Item 1 definition
; Item 2: Item 2 definition
; Item 3: Item 3 definition

The above example creates a definition list of three terms.

Unlike numbered lists, this kind of list does not suffer from issues of a broken list, as the colon and semicolon control everything.

Combine List Types

Similar to HTML, it is possible to combine different types of lists.

*Item 1
*Item 2
*# nested Item 1
*# nested Item 2
*Item 3

This example combines a number list and a bulleted listed with bullets being the main list type.

#;Item 1
#: Item 1 Definition
#;Item 2
#: Item 2 Definition

This example combines a number list and a definition list.


Tables are as different as lists, when it comes to HTML counterparts.

| '''Wordpress''' || Blog platform that can be self-hosted or installed on another server, but is difficult to get working properly on both LAN and the Internet
| '''Pivotx''' || Formerly called Pivot, it can be self-hosted or installed on another server.  Installation and setup is much easier than Wordpress, but imported posts do not show automatically

The example above is just the bare bones minimum of a Table. It looks much harder, even for me, to deal with since HTML tables appear to be a bit more readable. To have a border, enter:


If this is entered after the markup to initiate a table, a border will be revealed.

Table Headings and Captions

Both table headings and captions are a bit different from its HTML counterparts.

{| border="1"
|+'''Blog Platforms'''
| Wordpress || Blog platform that can be self-hosted or installed on another server, but is difficult to get working properly on both LAN and the Internet
| Pivotx || Formerly called Pivot, it can be self-hosted or installed on another server.  Installation and setup is much easier than Wordpress, but imported posts do not show automatically

This code will create a table with a border, some headings, and a caption describing the table, so that the reader can understand the table better.

Stylize Tables

Like HTML, tables can also be stylized in wikis. Most often times, it can be done through CSS properties.

{| border="1" align="center"
|+'''Blog Platforms'''
| Wordpress ||style="background-color:#FF0000; color:#FFFFFF"| Blog platform that can be self-hosted or installed on another server, but is difficult to get working properly on both LAN and the Internet.
| Pivotx ||style="background-color:#00FF00; color:#000000"| Formerly called Pivot, it can be self-hosted or installed on another server.  Installation and setup is much easier than Wordpress, but imported posts do not show automatically.

The above code centers the table and uses a different background and font color, both specified in hexidecimal, for each row.

Sortable Tables

If one so chooses, the table can be made sortable.

{| class="sortable"

The above code is all that is needed for users of a wiki to be able to choose how they want the table to be sorted.

Mathematical Formulas

Formulas are something that HTML cannot show extremely easily, hence the reason W3C came up with a standard for it. However, MediaWiki does not follow that standard.

<math>\left(a * 1000^2 \right)/1024^2</math>

The above example would display the formula for finding the actual storage capacity of something like a 512 MB USB flash drive. While I did not create the formula first, I did discover it through trial and error runs in a spreadsheet application, so I do know the pattern up to, and beyond, YB.


As is seen through each of the examples given, wikitext is the main formatting markup language in MediaWiki. When writing on wikis, it is usually best to use only wikitext, but as pointed out on the section about number lists, there are times that HTML is works out better. HTML will be discussed better later in the wiki, as some of it is actually used on this wiki to explain things, instead of using definition lists.

It is possible to write things without knowing wikitext, but the editor on MediaWiki will just display the wikitext for what one wanted in the editor. Also, it is incapable of removing wikitext formats, once they have been applied, so understanding wikitext will help in being able to correct things more readily, as well as do things that the editor is incapable of doing for the user.

wikitext can be escaped by one of two methods


The above code will escape wiki text, but will put a box around the character without either a space before tag is implemented or the second method is used in conjunction with it.


The above code will escape all wikitext within the tag and place it inside a box, however, not all tag will appear, unless you nest it with a duplicate tag.


As was mentioned before, HTML can be used, but full HTML support is not enabled by default. From my own use, and the book here are some tags that work. Please note that this list is not complete.

HTML that works by Default
Tag Description & Possible Usage
<span> This tag can be used to apply styles to certain text, such as font coloring, background coloring, or provide more info on something by using the title attribute (i.e. <span style="font-style:italic" title="Platorform used by Wikipedia">MediaWiki</span>)
<abbr> This tag is mainly used to describe abbreviations. When in proper use, it will not found without a title attribute (i.e. <abbr title="HyperText Markup Language">HTML</abbr>)
<acronym> This tag is mainly used to describe acronyms. Like the tag mentioned in the row above, it will not be found without a title attribute, when in proper use ((i.e, <acronym title="National Aeronautics and Space Administration">NASA</acronym>)
<div> This tag is used in CSS layouts to easily arrange multiple pieces of content. In HTML 4 and XHTML 1.0, all text must be contained inside either the <p> tag or inside this tag. To see such an example, visit my website and view the source code.

There are other tags mentioned in the book, one of which was already mentioned here, but I will let people test out some tags on their own, as it would take too much time to list every single tag.


Categories are a simple way to organize wikis. As such, it can make the wiki easier to navigate and maintain.

Category:Category Name

When the example above is entered entered into the search, two events can occur. First, if the category does not exist, a user will be able to create a category page. It can also happen if the category exists, but it does not have a page. If the category exists, the user will be immediately taken to the category page.


When the code above is included in a category page, it will become a hidden category and it will not be visible on articles assigned to that category.