Necessity of Organizing Content
As the site grows, the numbers of users and articles also grow. The necessity of organized content arises because:
- As the number of users keeps growing, the articles and other contents such as images, media files, etc., will keep growing. In order to maintain the large number of articles and content, we need a proper structured system to organize all the content. Think of a library where hundreds and thousands of books are kept. If those books are not kept in order, then where should a person look for a particular book? For users, it will be really nice to have proper organized content rather than disjoint and unorganized content.
- As the number of articles keeps growing, it is also necessary to categorize them. It is very easy to find a particular article and maintain it based on the category. Carrying on our library example, if we keep a section for horror books, and under this section we keep relevant comics, stories, novels, and movies, then it will be much easier for someone to point to the horror section and find the right movie there. One thing we have to remember: the more organized a site is, the more user friendly it is. Users love sites that are friendly to use and adopt.
- Sometimes it is required to break an article in several pages as the article is very big and difficult to maintain on a single page. Users usually have to scroll through the huge amount of text, and this can be problematic. Also, editing a huge amount of content at once can be difficult. So we need to know how we can manage such big articles by breaking them into sub-pages and also keeping them together so that user can find them easily.
MediaWiki can help us in this regard. MediaWiki has some built-in features that can make our task very easy and simple. These software features are very important components of MediaWiki since organizing in a collaborative community is not that easy. We will now focus on a few MediaWiki features that can be used for better content organization.
MediaWiki Content Organizing Features
MediaWiki handles these major issues without any problem or complexity whatsoever. The concept and the application of organizing content in MediaWiki are easy to grasp and apply. MediaWiki has the following software features to strengthen its organizing ability.
- Namespaces
- Categories
- Templates
- Sections
- Redirection
We will now explore some of the features in detail with examples.
Namespaces
Namespaces are used to group together similar type of contents. Namespaces divide a wiki into different areas so that each functional area is clearly defined. Namespaces can segregate different types of content that may exist under the same title. Generally, namespaces should not be used to categorize content of the same type as we can use categories for that.
The namespaces that come with MediaWiki illustrate this "content type" distinction:
- The Main, un-prefixed, namespace is for the primary content to be maintained in the wiki.
- The Talk namespaces are for discussion.
- The Project namespace is for policies, votes, and meta-information.
- The Image namespace is for images.
Namespaces allow separation of content for better management. One thing about a namespace is that it is not created by the users themselves. MediaWiki has some pre-defined namespaces and administration can add new namespaces if required. The namespaces that are added by the administrator are known as custom namespaces. It is always important to let users know about the custom namespaces available in the site.
Like the Image namespace, there are 17 other namespaces available in MediaWiki for special purposes. So when should one create a custom namespace? Essentially, if you have some type of content that you feel is substantially different from the content in the existing namespaces, you may want to consider creating a new namespace. For our Haunted site, we can have a movie namespace, so as to accommodate movie descriptions and trailers. Now let us focus on how we can use namespaces.
A page title in MediaWiki consists of two parts separated by a colon (:). The part before the colon is the (optional) namespace, and the part after the colon is the required page title. An example page title with a namespace is Help:Namespace, which will take us to the Namespace page under the Help namespace.
A page title without a colon belongs to the Main namespace. There are as many as 18 namespaces in MediaWiki, among which two are used as pseudo namespace, and 16 separate namespaces are defined by MediaWiki. Although there are 16 defined namespaces in MediaWiki, eight of them are talk pages of remaining eight namespaces.
A talk page is a special type of page used for discussions. On a talk page, users can communicate as in a forum. They can write their views or share their ideas on certain topics. Every page and namespace has an associated talk page (except for the Special namespace).
Here is a list of 18 namespaces in MediaWiki and a summary of their functionalities:
Creating New Pages in a Namespace
Though we have 18 namespaces altogether, we cannot create new pages in all the defined namespaces. Most pages in a namespace are generated automatically by the system itself, and hence new pages cannot be added to them. It is also not recommended to alter anything that is defined by MediaWiki.
Special pages are generated during installation. After that we cannot add any new pages to the Special namespace. Media and image pages are created when a file is uploaded to the server. So we cannot create a new page in these cases unless we upload a file to the server. It's the same with the User namespace, where all active users have their own pages, which are generated during user registration. Talk pages are generated automatically with their respective pages. So we are very much limited as far as accessing namespaces for adding new pages is concerned. We can add content to the Main, Project, Template, Help, and Category namespaces as well as to custom namespaces (if any).
To create a new page or access an already existing page in a namespace, we can recall our knowledge of creating a new page. We simply have to write the page title after the namespace's name followed by a colon in the address bar of the browser. For example, Help:How to use Namespace will create a page inside the Help namespace with the title How to use Namespace if the page does not exist. If the page exists, then this will take us to that page
If the given namespace is not recognized by MediaWiki or does not exist, then the page will be generated inside the Main namespace. In other words, if the namespace does not exist, then it will not be created automatically by the system.
One thing we have to remember is that a page can exist in only one namespace at a time. A single page cannot reside in two namespaces. Separate namespaces can contain pages with the same title, but can't contain the same page. Another important thing to remember is that there is no way in which you can view all the available namespaces on a site. Unless explicitly expressed by the site administrator, it is not possible for visitors to know about the available and custom namespaces other than the default ones.
An Alternative for Namespaces
A project or a wiki can be used instead of creating namespaces. This is sometimes advantageous, but at times is just overkill. Suppose we want to create a multilingual site for our Haunted information. So there will be a German site, an English site, a Spanish site, etc. There are two ways we can do that: we can create separate namespaces for each of the languages, or we can have a separate wiki site (project) for each language! Let us explore the key comparisons between namespaces and projects:
Category
Have you ever visited Wikipedia for your favorite "James Bond" movie? You will find that there is a category on James Bond movies, and it looks like this:
They have actually put all the James Bond movies under a single category so that visitors can find everything under this category. This is a very good and effective way of organizing content, and can be achieved through MediaWiki's "category" feature.
We have seen that namespaces cannot be created by users as they have some limitations. We need a feature that helps us categorize the content that is similar in type and work without any intervention from an administrator or privileged users. MediaWiki has a feature called category, which solves this problem.
Creating a Category
To create a category page, we must add a colon (:) in front of the Category tag. So the tag for creating a category will be:
[[:Category:Category name]]
The tag has to be typed in the edit box and then the page has to be saved. This will show the category link at the bottom of the page, and a click on this link will take us to the edit page for that category, where we will see an edit box similar to that for a normal wiki page. The key difference between a normal wiki page and a category page is that in a category page the articles and subcategories are displayed in an alphabetical order. These cannot be edited by the users.
The alphabetical order of a category list follows the sequence shown in the following information box. It is based on the Unicode order. Here is a partial list of the order sequence that MediaWiki follows:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_'abcdefghijklmnopqrstuvwxyz{|}~
Note that 1 comes before A, and Z comes before a. In the category listing page, the order will be maintained in this manner. For the complete ordering list you can visit the following URL:.
A category page contains following information:
- Page content or editable text, which can be edited using the edit link in the page just like a normal wiki page.
- A list of subcategories, along with the number of subcategories; if there are no subcategories, the header and count are not shown.
- A list of pages in the category, excluding subcategories and images. The number of items in this list is called the number of articles; if there are none, the header is shown anyway, and there are 0 articles in this category.
- A list of images with thumbnails (without the number). The first 20 characters of the image name are shown, with an ellipsis if that is not the full name; the file size is also shown.
- A list of parent categories. Categories are separated by the pipe character if there is more than one category for the page.
Putting a Page into a Category
A page in any namespace can be put in a category by adding a category tag to the page. The syntax for this is:
[[Category:Category name]]
If the category name specified in this tag exists, then the page will be added to the category. However, if the category does not exist, then MediaWiki will first create the category and then add the page information to the category. 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, which is in the namespace Category. Pages can be included in more than one category by adding multiple category tags. Suppose one of our ghost stories "A night in the jungle" belongs to the short story, real-life story, and self-experience categories. Then to indicate that it belongs to these three categories, we need to add the following tags in the story page:
[[Category:short story]]
[[Category:real life story]]
[[Category:self experience]]
The categories will then show up at the bottom of the story page, separated by the pipe character as follows:
Category links do not appear at the location where we inserted the tag, but at a fixed place, depending on the skin we have chosen. Category tags may be placed anywhere in the article, although they are typically added to the end of the article to avoid undesirable text-display side effects. Category links are displayed in the order they occur in the article.
Unlike a namespace, a single page can reside in any number of categories that you define. The following example demonstrates the key differences between a namespace and a category.
As we can see, a single story can reside in more than one category, which is very efficient in the sense that we don't have to create the page more than once for the categorization. The category just holds the reference of the page; so the overhead of page creation and space is not a consideration here.
Creating Subcategories
Subcategory creation is as simple as category creation, and the good thing about it is that there is no separate syntax for creating a subcategory. We have to use the same tag as we used for creating a category here. However, one thing we have to remember is that since there is not special syntax that will describe category B as a subcategory of category A, we must follow a rule for creating subcategories, which we will call the bottom up rule. Look at the following picture:
We have divided our story section into two subcategories: Short Stories and Series. The short stories section is also divided into two subcategories: Less than 1000 words and More than 1000 words. In order to indicate that Story has subcategories called Short Stories and Series, we have to put the category tag in both the Short Stories and Series pages to indicate that they are subcategories of the Story category. The syntax will be exactly like this in the two pages:
[[Category:Story]]
The story page now has two subcategories. One good aspect of categories is that they can be nested, i.e. one category can have multiple subcategories and each subcategory can have multiple subcategories, and in this manner the tree can keep going deeper. In the previous example, we have two levels of subcategories. So as we can see, we have to go to the subcategories first to indicate their parent category, and in this way we move from the bottom of the hierarchy to the top. That's why I call this the bottom up rule.
Here is an example of a subcategory page:
As you can see from the example screenshot, both subcategories and parent categories shown in the page are the just immediate parents or subcategories. For "story", we have the subcategory "short story". For "short story" we have subcategory "less than 1000 words". So when we are in the story page, it shows the subcategory as "short story", and not the "less than 1000 words" subcategory.
How to View the Category List
We have a separate page dedicated to viewing the category list for the wiki site. From the toolbox section on your left navigation panel, click on the Special pages link. It will take you to the list of all the special pages under the wiki site. You will see that there is a link named categories. Upon clicking the link, you will be redirected to the category page where all the categories and subcategories are listed. You can also add Special:Categories to the end of the page URL to come to this page. The category listings are shown alphabetically on the page.
Using Sort Keys to Sort Category Listings
When we are in any category page, we can see listings of subcategories and articles for this category. Most of the time, articles are listed according to their title. So in alphabetic order, the first character of the title influences the order of the article. Sometimes it becomes necessary to put the article in a different order without changing the title. How can we do that? Well, we can do that using a feature called sort keys in MediaWiki. Sort keys are used with category specification in an article using the category tag. The sort key, which is also known as the alternative name, is written with a pipe character after the category name, as follows:
[[Category:category name|sort key]]
So suppose we have a page title "A night in the jungle". According to the convention, it will be listed under A in alphabetic order. However, if we want to list it under J, then we have to write the category syntax as:
[[Category:real life story|Jungle Night]]
or simply as:
[[Category:real life story|J]]
So when we view the category page, we will see:
This is a great way of showing and sorting the article listing. However, we have to be careful about the sorting. The sort key is case sensitive; so a page with the tag [[Category:real life storyJungle Night]]| will come before a page with the tag [[Category:real life storya night in jungle]]|, according to the alphabetic ordering of the listing.
Summary
We have learned the importance of organizing and managing content for a site. We have also seen MediaWiki Content Organizing Features like Namespaces and Categories. In the next article, we would discuss some more MediaWiki Content Organizing Features like Templates, Sections, and Redirection.
If you have read this article you may be interested to view :