From WikiEducator
Jump to: navigation, search
Vista Community Help.png

Categories and Categorising

Road Works.svg Work in progress, expect frequent changes. Help and feedback is welcome. See discussion page. Road Works.svg

Categories are a feature of the MediaWiki software, enabling the creation of automatic listings of related content on to defined "Category" pages.

30-second summary

Any editable page can be added to a category by adding a category tag, e.g., "[[Category:Category name]]" or "[[Category:Category name|Sortkey]]", in that page's wikitext. The categories to which a page belongs appear in a box at the bottom of the page. Pages can be included in more than one category by adding multiple category tags. See Special:Categories for a list of all of the categories in this wiki.

The category page is an automatic listing of links to all of the content pages which include that category tag, as well as a listing of other related categories, called subcategories. Each category page is part of the "Category:" namespace. A category page contains text that can be edited, like any other page. The text is displayed in the category header. The category header should include a brief definition of the term or phrase, and what sort of content would be found in it. If the category is populated by use of a template, brief instructions should also be included as well as a link to that template. To link one category as a subcategory of another, add the parent category tag to the child's category page.

What are categories?

A category is just what it sounds like: a method of grouping pages according to their content. Categories also work with parent-child connections in the same way that subpages do. The category you put a page in will actually be a subcategory of another. A category system has many levels within it and a well-developed category system defines many useful relationships among the pages in the wiki. While a subpage can only have one parent page, any page or category can be in as many categories as we like. This is where the MediaWiki software becomes genius in its use of virtual reality; even though there exists only one document, at a single url, it can be found and related to other documents in any number of ways. This creates a powerful browseability that is trumped only by the searchability of the SemanticWiki extension, which involves a steep learning curve.

Why categories?

The category system is a method of organising content built-in to the MediaWiki software. It creates relationships between content that cannot be defined by subpages, making it easier for members to move from page to page and between related information. Want to know what other projects there are on astrophysics? The category system will tell you that. Want to be able to find all the resources from Otago Poly-Tech easily? Curious about what 10-year-old children are learning elsewhere in the world? The category system allows for these. Using the category system is preferred over contents listing pages because it requires far less effort from members to keep current. To add a page to a category, one never has to leave the page, itself!

The other key factor for categorising pages is a concept called "search engine optimisation" (SEO). You may have heard of this if you are in any way involved with web publishing. The point of SEO is to increase readership organically (they come to us, we don't market directly to them). This is done by appealing to the formulas Google and other search engines use to determine who goes at the top of any search list. The thing is, if there aren't any links to a page, Google never sees it! Categories create a link-based map of the website, allowing Google's programs to see each page that has a category.

Adding a page to a category

To add a page to a category, simply include the category tag for the identified category, [[Category:Category name]] or [[Category:Category name|Sortkey]], to the wikitext on the page. Note that the category tag must be processed, i.e. it will not work if it appears between ... or tags, or in a comment. The declaration may however come from the application of a template, e.g., adding a note to a page using Template:note automatically adds the page to Category: Pages with editorial comments.

In WikiEducator, it is customary to place wiki category codes at the end of the wikitext.

Once the category tag on the page is processed, the name of the page will be listed automatically on the category page. When a page has been added to one or more categories, a categories box appears at the bottom of the page. This box contains a list of the categories the page belongs to, in the order in which the wiki category codes appear in the processed wikitext. The category names listed on the page are links to the corresponding category pages. They appear as redlinks if no category page currently exists.

To see a list of all the currently available categories in this wiki see the Special:Categories page .

To link to a category page without putting the current page in that category, precede the link with a colon: [[:Category:Category name]]. Such a link can be piped like a normal wikilink.

A category name can be any string which would be a legitimate page title. It cannot begin with a lower-case letter. If the category name given in a category declaration begins with a lower-case letter, then it is interpreted as if it were capitalized.

Category pages

A category page is a page in the "Category:" namespace. The page "Category:Name" corresponds to the category called "Name". New category pages can be created like any other page – by clicking on redlinks or entering the name in the search box and clicking "Go".

A category page can be edited like any other page. However, when it is displayed, the editable part of the page is followed by automatically generated lists of pages belonging to the category. The lists are organized into three sections: Subcategories (other category pages belonging to the category), Pages (excluding subcategory and image pages), and Media (image, video, audio and file pages).

An example category page
Each list is preceded by a count of the number of entries in that section, however if there are no entries in the Subcategories or Media sections, that particular section does not display. When there are no Pages in a category, a message to that effect is presented.

Each media file is displayed as a thumbnail. The first 20 characters of the file name are shown, with an ellipsis if that is not the full name; also the file size is shown.

The items in the lists all link to the pages concerned; in the case of the media files this applies both to the media "image" itself and to the text below it (the name of the file).

For the way in which the lists are ordered, see Sort order below. The Subcategories and Pages lists are grouped according to the first character of the sort key, or the first character of the title, in the absence of a sort key. These initial characters are displayed above each grouping.

A category page can only display a limited number of listings in each section (currently 200). If more subcategories, pages, or media belong to the category, there will be a link to the next page of listings.

The categories box for the category page appears at the bottom, in the same place as for other pages. The box contains the categories to which the current category page has been added, i.e. its parent categories (the categories of which it is a subcategory). A category page can be added to other categories in the normal way, using the "[[Category:Category name]]" or "[[Category:Category name|Sortkey]]" syntax.

Sort order

The sorting system uses alphabetical order, or more precisely Unicode order, for pages in categories:


Note in particular that "Z" comes before "a", and "z" before accented/umlauted characters.

A space is treated as a space (coming before all other characters), not as an underscore, which can be useful if the category has a main page that would be best sorted to the top of the list.

Each of the three lists on a category page is arranged in the order explained above (except that in the subcategories list, the namespace indicator "Category:" is not considered). If you want an item in a list to be positioned differently, an alternative name (that is, a sort key) can be specified in the category tag that places the item in the list:

[[Category:Category name|Sort key]]

For example to add a resource called "William Shakespeare" to the category "Drama" and have the article sorted by "Shakespeare, William", you would type "[[Category:Drama|Shakespeare, William]]".

Although this is like the syntax for a piped link (and in an edit summary it is interpreted like one), there is a clear difference: the second term in the piped link is an alternative term for the first one, while the sort key is an alternative name for the page in which the tag occurs. The name actually displayed is the name of the article, not the sort key. Also, a piped link influences the rendering of the page itself, while a sort key affects the rendering of another page.

It is useful to document the system being used for sort keys on the category page; for an example see Category:Math glossary.

Default sort key

It is possible to set a new sort key for a page which is different from the default {{PAGENAME}} by adding the magic word {{DEFAULTSORT}} to the wiki code on the page, thus:

{{DEFAULTSORT:new key}}

In the case of multiple default sort key tags, the last one on a page applies for all categories, regardless of the position of the category tags. This also means that a DEFAULTSORT tag in a template, intended for category tags in that template, that is, for categorization of pages calling the template, is not effective if another DEFAULTSORT tag occurs later on these pages, even if it is also "hidden", in another template.

Use of this magic word is not required on a page. There is no need to override the default sort key if it is identical to the page name.

Creating a category

If you have checked the Special:Categories page and there is not an already existing category that might apply to content you are working on, you can create a new category by adding the syntax [[Category:Category name]] to your page. After saving your page you should follow the link that has been created for your new category and place some instructions on that page to let other users know how to use the new category.

Moving a category page

The only way to move a category page is to manually change all category tags that link to the category, and copy the editable part. There is no automatic way to move a category page in the way one moves a resource page.

The editable first part of a category can be moved like any other page, but that won't move the subcategories, resource pages, and images in the second, third, and fourth parts of the page as displayed (see above). For categories entirely populated by templates (see above) modifying the templates moves all affected pages to a renamed category.

Redirecting a category page is possible using the category redirect template, which creates a soft redirect to the desired category. When this template is added to a category page, the category will be categorized into Category:Category redirects. Please note that after all pages are moved from the "old" to the "new" category, the "old" category will be listed only in Category:Category redirects.

Item Categorizing Criteria

  • Persons
    • Country
    • Profession
    • Filiation
    • WikiEducator Certification
    • WikiEducator Role
    • Discilpline

  • Organizations
    • Community of Practice
    • Geographic region
    • Main Activity
    • Filiation
    • Domain

  • Projects & Initiatives
    • Context
    • Status

  • Objects (Image files, sound files, video files, text files, etc).
    • Specific Set/Project
    • Country
    • Usage
    • Taxonomy (organisms)
    • Typology (things)

  • Open Educational Resources (OER)
    • Grade / Age level
    • Subject

Best practices for Categorizing

Resources related to Categories and Categorising

Information about this resource

  • The sections "Adding a page to a category" and "Category pages" are adapted from Wikipedia's Help:Category page.
  • The section "Moving a category page" is adapted from Wikiversity's Help:Category page.