What are MediaWiki Namespaces and what is their purpose?

Part of dealing with open source software is being part of the community, and as MediaWiki is a large part of the work we do, I spend at least a few minutes most days looking at, the unofficial MediaWiki form.

One query that popped up today was this one, which asked about the use of Namespaces in MediaWiki and their potential uses in organising content within a wiki. I’d had this post in a draft state for quite a while, so it seemed like a good time to finish and publish it!

This is something I cover in our MediaWiki training courses, and I’ve pulled the gist of how I try and explain the concept of Namespaces to clients below.

What is a MediaWiki Namespace?

A Namespace in MediaWiki groups like content together. Unlike categories which nominally group content related by topic (e.g., the Cat and Dog page may both be in the Pets category), MediaWiki Namespaces are a way to group content by purpose.

The purpose of MediaWiki Namespaces

Namespaces can be used to control permissions over the content they contain. E.g., you can more easily restrict certain user groups to viewing/editing content within a specific namespace than you can over a specific page.

For example, you might have a specific namespace for a project (let’s call it ProjectX), and by grouping all of the content for it within that namespace (so you would have pages called ProjectX:Page_1, ProjectX:Page_25, etc), you can control who’s able to see/contribute to that content.

Searches can also be conducted within a specific namespace, so using namespaces can make searching for content in your wiki much easier.