Help:Categories Example

From SME Server
Jump to: navigation, search

To start off with, the fundamental principle of categories: you create them by categorising articles (pages).

Example is based on bananas beloning to fruit, and fruit beloning to food

How do I create articles?

Type into the search box the exact title of the page you would like (including appropriate grammar (eg "Bananas" instead of "bananas"). On the following page it should say "there is no page called 'Bananas'. Click here to create this page". Click on that red text!

It will take you to an editing window. That's where you enter your content for the page called "Bananas".


How do I create the main categories

Just say one of your main categories is "Food". In your article called "Bananas", you would include the category tag: [[Category:Food]]. So, just put [[Category:Food]] into the edit window where you're creating or editing the "Bananas" page. It doesn't matter where on the page you put the category tag in the edit window - it'll always appear at the bottom of the page when you're viewing it.

This will mean that on the article "Bananas" (when viewing, not editing), down the bottom would be "Category: Food". "Food" might be in red here - if you click on it, it will take you to the "Food" category page with an edit window. You will be able to see that "Bananas" is listed there, so if you put in some content such as "this category is about food! you can eat food!" and save, you can see how the category displays - with your description/notes, and then an automatic list of pages categorised under "Food".

  • How do I add them to the main page without having the main page show up as an article in the categories?*

You need to include a colon before the "Category" in that category tag. So, to link to the "Food" category: [[:Category:Food]] That will display as a link to the "Food" category that looks like: "Category:Food".

If you want it to just say "Food", then use pipes as you can with any wiki link: [[:Category:Food|Food]] or [[:Category:Food|Go to the Food Category!]]

whatever appears after the pipe (|) will be your link to what appears before the pipe.


How do I create sub-categories

Sub-categories are created by categorising categories! Remember that edit window that came up when you clicked on the red link to the "Food" category at the bottom of the "Banana" article? You can edit a category page using the edit tab as you would any article.

Just say you want to create a sub-category called "Fruit". You would:

Go to the "Banana" article, add the category tag: [[Category:Fruit]]. (If you add this after the [[Category:Food]] tag, then at the bottom of the "Bananas" article it will display thus:

Categories: Food |Fruit

Click on the red "Fruit" link in the categories box at the bottom of the "Bananas" article. It will take you to an edit page for the "Fruit" category. To subcategorise "Fruit" in "Food", put [[Category:Food]] on that "Fruit" category page you're editing and save.

Now go to the "Food" category (you should be able to click a link to it in the category box at the bottom of the "Fruit" category). You'll be able to see on the "Food" page now that it has one subcategory: "Fruit", and one article: "Bananas".

"Bananas" shows up on both the "Fruit" subcategory and the "Food" category because it has the category tags for both of them on it.


How do I add the top level cats to the sidebar without the subcats

In your search box, type in "MediaWiki:Sidebar" (without the quotes).

This will take you to the page where you can edit the sidebar on your wiki. If you click "edit" you'll be able to see the format of how it works. A single asterisk point creates a new heading and a new box. Double asterisk points create the links within the navigation box. So, if you want to replace the default navigation box, you may want to do it thus:

* main categories:
** :Category:Food|Food
** :Category:Plants|Plants
** :Category:Animals|Animals

As you can see it works similar to the linking-to-categories code (with the colon and the pipe), but without the [[square brackets]] usually required in wikicode links. This is a rule specific to the sidebar.


As a side note, you might find it useful to sketch yourself up a sitemap to create your category structure if you don't yet have articles to put in all of them (this overcomes that problem of having to create categories via articles).

What I've done is just create a page called "Sitemap", then put in links to all my categories and subcategories, thus:

* [[:Category:Food]]
** [[:Category:Fruit]]
** [[:Category:Nuts]]

*[[:Category:Plants]]
** [[:Category:Trees]]
** [[:Category:Flowers]]

* [[:Category:Animals]]
** [[:Category:Mammals]]
** [[:Category:Crustaceans]]
** [[:Category:Reptiles]]

When you save that page you'll see that most of them will be in red (if you haven't followed the steps outlined above re: creating/categorising an article).

With the sitemap, it's a handy way to go in and sub-categorise all your subcats - so, click on "Category:Nuts" and put in a [[Category:Food]] tag to subcategorise it.