Working With MediaWiki
pages. Categories, for that reason, have been used in a large variety of ways — you only have to look at the explosion of categories on Wikipedia to see that.On the English-language Wikipedia, there are at least 6 ways in which categories get used:
to establish the basic type of the page’s subject, e.g. “Space Shuttles”
to define further characteristics of a page’s subject, e.g. “Italian generals”
to note a larger topic to which this page’s subject relates, e.g. “Theosophy”
to tag temporary information about the page itself, e.g. “Proposed deletion as of September 20, 2012”
to serve as a container super-category for other categories, e.g. “Symphonies by composer”
to tag pages other than regular pages or categories, e.g. “Animal templates”
There are better ways of tagging much of this information, which take less work and lead to less redundancy. In fact, Semantic MediaWiki, which we’ll get to in later chapters, was first thought up in part in order to remove the need for the profusion of categories on Wikipedia. Still, even with Semantic MediaWiki, categories play an important role.
Let’s look at how categories are defined and used. Any content page in MediaWiki can be added to a category, including images and files, as well as category pages themselves. In all cases, adding a page to a category consists of just adding the following text to anywhere in the page:
[[Category: category name ]]
Nothing will be displayed where that text was added. Instead, at the bottom of the page, text that looks like the following will be displayed, showing all the page’s categories, in the order they were defined on the page:
Categories : 1899 births | 1957 deaths | 20th-century actors | Actors from New York City | American chess players | American Episcopalians | American film actors ...
Category tags can go anywhere in a page, but to keep things readable, the usual convention is to place them at the bottom of the page, with one tag per line. So the wikitext that would generate the previous set of displayed categories might look like this:
[[Category:1899 births]]
[[Category:1957 deaths]]
...and so on.
There’s one other important place in which categories are declared: within templates. On Wikipedia, the “Proposed deletion...” categories are one example of categories set via templates. (When using Semantic MediaWiki, it is in fact recommended that all category declarations be made via templates; you can see a full explanation of that here .)
Every category has a page in MediaWiki associated with it, which is just the name of that category, preceded by the name of the category namespace, which in English is just "Category:". So the page for a category called “Cars” would be at “Category:Cars”.
Let’s go through the structure of a category, using a real-life example. Here is the top of the page “Category:Hydraulic engineering” category on the English-language Wikipedia:
The top part of the category page consists of whatever text has been manually placed there. Below that is the set of subcategories, if any, for this category; i.e., categories tagged as belonging to this category. Here is that list, again for the Hydraulic engineering category page:
The categories are displayed in alphabetical order, in three columns, with headers for each initial letter. There is also an arrow next to each subcategory name, which can be used to drill down through the hierarchical list of subcategories for each of these subcategories. This arrow functionality is not standard, and comes from the CategoryTree extension ( see here ).
Finally, there’s the heart of the category page: the listing of all the pages it contains. Here is just the top of that list, again for the same Wikipedia category:
Pages, like subcategories, are displayed in three columns, with headers for the first letter of the name.
If a category contained any images, below the listing of pages would be a display of the thumbnails of all the images, in gallery format (this is not shown here).
If you click on a category name, and the page for that category hasn’t been created yet, you’ll see a message saying that the category doesn’t exist yet; but it will still list all its pages and/or subcategories. Every category that’s used should ideally have a page created for it. You have to add some content to a page in order to be able to save it: a simple sentence explaining the category is usually what’s
Weitere Kostenlose Bücher