Tutorial: Organizing wiki content using MediaWiki

In this article series by Jeff Orloff and Mizanur Rahman, authors of MediaWiki 1.1 Beginner's Guide , we will learn how to organize our content by creating namespaces that allow us to group pages with similar purposes together, and we learn how to use categories to group pages with similar content together. It also teaches us about redirecting, moving, and swapping pages around so that we can ensure when a visitor comes to our site, they find the information they are looking for because the page titles will match up with page's content. MediaWiki has many built-in features that will not only help us keep our content organized, but make it extremely easy to do this.

In this article, we will learn how to make use of these tools including:

  • How we can create Namespaces
  • How to create Categories
  • How to setup a Template for our users
  • Why we would redirect a page
  • How to move and swap a page

We have focused mainly on organizing content rather creating content in your wiki in this article. We assume you should have a few pages in your wiki. As our wiki grows in popularity, the amount of content it hosts will continue to grow so it is important to organize the content in your wiki so that our wiki looks better to our visitors and editing and reviewing content is much easier for our users. If we think of our wiki as a library, it is easy to see why we need to organize our wiki. After all, if you walk into a library with no system for organizing the books, movies, music, periodicals, and others you would find it hard to locate what you are looking for. Likewise, if we have no order in our wiki, then our visitors could find themselves frustrated when trying to find the information they are looking for. If they become too frustrated, they will go elsewhere.


Namespaces are used by MediaWiki to group together pages that have a similar purpose such as Help pages, User profiles, or Talk pages. This is not to be confused with pages that contain similar content. These pages are grouped by categories which we will discuss later in this article. Pages that exist within a namespace in a wiki are noted by the namespace prefix that helps to form the title of the page. For example, if we have a page called Uploading a video file that exists in the Help namespace, it would appear as Help:Uploading a video file. Perhaps you want to create a new page for an upcoming marketing project for your company. This would appear as Project: Marketing project. MediaWiki makes use of 18 built-in namespaces. The odd number namespaces are talk namespaces while even numbered ones represent subject namespaces.

Numerical index





This groups together a majority of the site's content. There is no namespace prefix for the mainspace.



The discussion pages attached to the mainspace pages.



Pages that contain information about users and their history.


User talk

Used to leave messages to a user.



Used for information related to the operation and development of the wiki. This is also known as the meta namespace.


Project talk

Used to discuss project pages.



Stores metadata for files uploaded to the wiki. This includes images, sound, video, and other files accessed through the Media namespace.


File talk

Used to discuss files and media.



Contains system messages and other important content.


MediaWiki talk

Discussion pages related to the MediaWiki namespace.



Used to hold templates used in the wiki.


Template talk

Discussion pages for the various templates used in the wiki.



Holds help files, how-tos, and other instructions for users.


Help talk

Used to hold discussions related to the help files.



Holds information related to the different categories created for the wiki.


Category talk

Used to hold discussions regarding the wiki's categories.



Used for direct linking to media files [[Media:song.ogg]] rather than the information page.



Groups special pages created by MediaWiki itself.

Talk pages are accessed by clicking on the discussion tab at the top of a page.

The last two namespaces, denoted by the negative sign, are used for pages created by MediaWiki. Users cannot create, delete, or edit any pages in these two namespaces without special extensions. The remaining 16 namespaces are all used for user-created content.

The following screenshot shows the Help namespace for the Joomla! documentation wiki (http://docs.joomla.org/Beginners ):

Help Namespaces

Time for action – creating a page in a namespace

Content that is housed in many of the namespaces is created on the fly. For instance, when you first register as a user, a new page in the User namespace is created. When you create a Help page, a new page appears in the Help namespace. If you add to the discussion page for an article on your wiki, a new talk page is created. For Main, Project, Template, Help, and Category pages, we can add new pages directly into the namespace.

For example, if our IT department wanted a user manual for a new software package that was just installed, we could create a project page for this. In this instance, we would have to designate the namespace or it would default to a regular article.

  1. Open your wiki in your browser and log in.
  2. In your browser's address bar, type the following: http://www.yoursitename.com/index.php/Pr... page name. For the example site, I will be entering: http://www.flosspropopulo.com/index.php/Project:Using our new software . Hit Enter.
  3. Your new page should open up and look similar to the following screenshot:
    Project Page
  4. Right now, the project page tab is red because the page doesn't exist yet. Click on the edit this page link to create the page.
  5. When you are satisfied with the page, click Save page.

When the page has been saved, it will look similar to this:

Completed project page

You may have noticed that while the tab reads project page, the namespace is the title of our wiki. In this example, Floss Pro Populo appears instead of the word Project. As the project page deals with organization of the wiki, it defaults to the wiki's sitename to represent a project taking place within the wiki itself. This can be changed; however, it is something that should be done by more advanced MediaWiki administrators.

What just happened?

Instead of simply creating a new page, we used the URL to create a new page and included it in a specific namespace. In this example, we created a new Project page explaining the project that will include creating a user manual for a new software package. We also saw that of the 18 namespaces, we can directly create new pages using this method in only five of them. The other 13 namespaces have their pages created by MediaWiki itself when different actions are taken.

If you try to create a page in a namespace that doesn't exist, it will default to the Main namespace. MediaWiki will not create the new namespace for you.

Pop quiz – namespaces

Namespaces are important because they help keep our pages organized. As an administrator, it is important to know what kind of pages the different namespaces hold so we can find what we are looking for. To make user that you have a solid grasp of namespaces, let's take a moment to test your knowledge.

  1. All namespaces can be edited by the users.
    1. True
    2. False
  2. Most pages in the namespaces are created by MediaWiki when the user does something. Which of the following namespaces allows the user to directly create a new page (by using the URL)?
    1. Help
    2. File
    3. Special
    4. User
  3. According to the example above, which URL will correctly create a new page in the Category namespace?
    1. Category:New page
    2. http://www.wikiname.com/Category:New page
    3. http://www.wikiname.com/index.php/Category:New page

MediaWiki 1.1 Beginner's Guide
MediaWiki 1.1 Beginner's Guide
  • Install, manage, and customize your own MediaWiki-based site
  • Install and administer MediaWiki to build a successful wiki site
  • Master the many administrative tasks associated with running and securing your wiki
  • Clear focus on beginners with lots of step-by-step instructions and clear explanation
  • Up-to-date with version 1.15 of MediaWiki, released in June 2009

Creating a custom namespace

There may come a time when you feel the need to create a new namespace for your wiki. For instance, let's say that you are using MediaWiki to create a site dedicated to a user manual. In this manual, you may want to include tutorials for new users. You have the option of creating a namespace called tutorials to organize these pages where the purpose is to teach new users. A good example of this is Joomla!'s documentation site where they too have a namespace called tutorials.

Time for action – creating a new namespace

Creating a new namespace is extremely easy and requires us to go into the LocalSettings.php file and enter a few lines. That's it! As we have edited this file many times, this should be an easy task for us by now.

  1. Open the LocalSettings.php file for editing.
  2. Scroll down to the last line of the file and type:
    #Custom namespaces
    $wgExtraNamespaces[100] = "namespace";?
    $wgExtraNamespaces[101] = "namespace_talk";
  3. Substitute namespace for the name of your new namespace. In the example wiki, I used Tutorials and Tutorials_talk for the custom namespaces.
  4. Save the changes to your LocalSettings.php file.

Now, you can create a new page in your newly created namespace using the URL method in the previous exercise.

Tutorial Image

What just happened?

As we wanted to organize some pages into a namespace called Tutorials, we needed to create a custom namespace. We did this by adding a few lines to the LocalSettings.php file, one to create the namespace itself, and another to create the associated talk page.

We also indentified each custom namespace with a numerical index. For custom namespaces, MediaWiki requires us to begin with the number 100. The namespace Tutorials was given the numerical index of 100 and its associated talk namespace, Tutorials_talk, was given 101 as talk pages use odd numbers for this.


While namespaces help us to organize a page by the purpose it serves in the wiki, we need to be able to organize the actual content as well. This is where categories come into play. Categories allow us to take content pages that are related and group them together. Unlike namespaces, which can only be created by those with access to the LocalSettings.php file, categories can be created by the wiki's users.

Time for action – creating a category

There are two ways to create a category. The first method involves using the URL and the second makes use of adding wikitext to an existing page. Once the category is created, we can add more pages to this category. As we create the category pages, you will notice that the categories, and subcategories, follow the Unicode order.

Unicode characters are:

The first method we will use to create a category involves using the URL the same way we did to create a new page in the Project namespace earlier in this article. In this example, we will be creating a category called Office Suites in the FLOSS wiki.

  1. Open your wiki in your browser and log in.
  2. Enter the URL: http://www.wikiname.com/index.php/Category:Category name. You would substitute wiki name with the URL for your wiki and Category name with the name of your new category. For the example, I enter: http://www.flosspropopulo.com/index.php/Category:Office Suites. Hit Enter when you are done. The following screenshot shows how the category page looks so far:
  3. As the category page is not yet created, you have two options. First, you can click on the create tab to create an empty category page. The second option is to click the edit this page link. Follow along with the second option and click the edit this page link.
  4. Enter some content that explains the category page.
  5. Click Show preview to see how your category page looks. If you are happy with how it reads, click Save page.

Category Image 2

What just happened?

Using the URL method to create a new page, we added a category to our wiki. Once the category page was created, you probably noticed that at the bottom there is a note telling you that This category currently contains no pages or media. This is because while we created a new category, we haven't added any pages or files to the category yet. In the next exercise, you will learn how to add pages to your categories.

Adding a page to a category

Some of you may remember that I said there is more than one way to create a category page. Don't worry, I haven't forgotten. We are going to learn the second way when we learn how to add a page to a category.

Time for action – add a page to a category

To add a page to a category, we need only add a small amount of wikitext to the bottom of the page: [[Category:Category name]]. That's all it takes. Now, if the category name is for a category that has not yet been created, then MediaWIki will create it for you. So there you go, the second method for creating a new category! So let's add a page to our Office Suites category in the example.

That will add the page to our Office Suites category, but what if I want to add this page to another category? After all, OpenOffice.org is available for Windows, Mac, and GNU-Linux so shouldn't it be in these categories as well? Let's take care of that right now

  1. Create a new page. For the example wiki, we will create a new page called OpenOffice.org.
  2. Enter the content for your page.
  3. At the bottom of the page, type the wikitext to add it to a category. For the example, we will enter [[Category:Office Suites]] at the bottom of the page.
  4. Beneath the first category enter the syntax for each additional category. Our example will look like this when we add the other categories:
    [[Category:Office Suites]]
    [[Category:Windows software]]
    [[Category:Mac software]]
    [[Category:GNU-Linux software]]

    In this code example, I left the Office Suites category for effect. You would not need to type it in twice in your wiki.

  5. Click Show preview. If everything is as you want it to look, click Save page. Your new page will look like the following screenshot. Note the categories list at the bottom of the page.
    Categories List

What just happened?

As we created a category page in the previous exercise, we needed to add a page to it. To do so, we added a bit of wikitext to the bottom of a new page to put the page into the category. As the page we created could easily fit in other categories, we added additional Category tags to our page for the other categories. As these categories did not yet exist in our wiki, MediaWiki created them for us. Our category page for Office Suites now looks like the following screenshot:

Category Page complete


Have a go hero

Categories provide automatic indexes that are useful as tables of contents. The category tag lists the page on the appropriate category page automatically, and also provides a link at the bottom of the page to the category page. Go ahead and add categories to the pages you have created for your own wiki to better organize the content that you have already created.

To further organize your content, add categories to your category pages to create subcategories. No special syntax is needed, just use the category tag [[Category:Category name]]!.

Finding categories
You can view the category list on your wiki by clicking on the Special pages link in the tool box. In the Lists of pages section, you will find the Categories link. Click on this to view all the categories created in your wiki

MediaWiki 1.1 Beginner's Guide

MediaWiki 1.1 Beginner's Guide
  • Install, manage, and customize your own MediaWiki-based site
  • Install and administer MediaWiki to build a successful wiki site
  • Master the many administrative tasks associated with running and securing your wiki
  • Clear focus on beginners with lots of step-by-step instructions and clear explanation
  • Up-to-date with version 1.15 of MediaWiki, released in June 2009