This article shows two ways as to how you can easily add a page in MediaWiki to a category or multiple categories. It also explains who the renaming of a category in MediaWiki can be done without much hassle.
I was looking for a simple way to add a page to a category in one of my sites that uses MediaWiki. But I couldn’t find a simple step by step instructions when I searched for it in Google so I decided to write a post on it.
How to Add Categories to Any Page in MediaWiki
Option 1: The Easy Way (Without the use of any Extension)
Add [[Category: Category Name]] to the bottom of the page in order to add that page to the category
specified by the name “Category Name”.
- Open the page that you want to add a category to in edit mode.
- Scroll down to the bottom of the page and add the following and Save the page.
[[Category: Category Name]]
Where ‘Category Name’ is the name of the Category.
To put a page under multiple categories just add more Categories to the page like below:
[[Category: Category Name1]]
[[Category: Category Name2]]
[[Category: Category Name3]]
Option 2: The Easier Way (Using an Extension)
There are many extensions that you can use to add a page or article to a Category in a MediaWiki installed site. You can just search for category extension for Mediawiki and try out some of them.
I use the TagAsCategory extension and it is pretty good. It gives you a small text box like the following screen shot to enter categories to your Media Wiki page.
How to Rename a Category in Media Wiki
Renaming a category in Media Wiki can be a bit painful specially if you have a lot of existing references of that category as moving of categories are not allowed (Pages can be moved but not categories). As far as I know Wikipedia uses a bot to rename their category. Which could be a little hard to get your hands on.
I use the Replace Text Extension to rename my categories.
The Replace Text extension provides a form to let the administrators do string replacements on the entire wiki.
After installing, the extension can be used by navigating to ‘Special Pages’ and ‘Replace Text’ . The Replace Text is under the ‘Other special pages’ section. I use this extension to find all the existing occurrences of the current category name and replace it with the new category name. All the new category links will be broken at this stage but they will be good as soon as I create the new category page with the desired name. Finally, I delete the old category page to clean up. Using this method will ensure that no pages are still using the old category name.
Thanks for the tips. Worked great and saved me a lot of time!
-Tim