Help:Category: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
No edit summary
m Reverted edits by 87.116.143.144 to last version by Patrick
Line 1: Line 1:
{{H:h|editor toc}} <!-- do not remove this line -- it calls a template, that can accept arguments-->
== Категорије - разлози за, разлози против и закључак ==
A '''category''' is a software feature of MediaWiki.
Categories provide automatic indexes, that are useful as tables of contents. Together with [[Help:Link|link]]s and [[Help:Template|templates]] they structure a project.


==Putting an item in a category==
=== Разлози за стварање категорија ===
A page in any namespace can be put in a category by adding a category tag to the page (by convention, at the end of the page), e.g.:
Уколико некоме падне на памет "покрити" својим чланцима цело једно подручје (нпр. [[Математика|Математику]], [[Сунчев систем|планете Сунчевог система]], итд.) врло је згодно објединити тај рад некако, тако да сви лако можемо да видимо који су чланци из тог подручја написани.
То можемо учинити ручно, стварајући пописе које ћемо ручно одржавати (што је лако на почетку, али је дугорочно погрешан приступ, јер не пишемо чланке само ми, тако да попис ваља ажурирати не само ако смо сами додали неки чланак заданој теми, него треба повремено проверавати да ли је и неко други додао неки чланак теми, а није знао да постоји попис чланака задате теме), а друга могућност је ослонити се на аутоматско креирање пописа чланака који припадају одређеној теми.
Довољно је на дну странице да се напише '''<nowiki>[[Категорија:Име_категорије]]</nowiki>''', и ако дотична категорија још не постоји, биће креирана, али тек кад одете на страну категорије и на њој упишете основне податке категорија ће бити видљива, а чланак придодат тој категорији.


<nowiki>[[</nowiki>Category:''Category name'']]
=== Против категорија ===
Постоји становиште које тврди да је Википедија сама по себи прекрасна, пуна повезница, и да је наметање категорија заправо насиље над њом, јер онај ко жели да дође до информација сродних онима у чланку који управо чита, треба само да кликне на повезнице у чланку. Такво становиште има недостатака из бар једног разлога:


This 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. These links do not appear at the location where you inserted the tag, but at the page margin in a fixed place, depending on the skin (the bottom for Monobook, the upper right corner for Standard). 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 the automatic ordering of lists in the category pages themselves (see below).
*неки чланци на Википедији у себи не садрже ни једну повезницу, тиме нису ништа мање вредни од других чланака пуних интерних повезница, но читалац нема лаког начина да дође до осталих чланака из истог подручја на Википедији (мора користити неки вид претраживања);
*неколико чланак и садржи повезнице, те повезнице не морају упућивати стриктно на остале чланке теме коју чланак обрађује, него могу да упућују на неке сасвим нове теме, у духу Википедије


=== Закључак ===
== Executive summary ==
Each of the pages in the '''Category''' [[Help:Namespace|namespace]] represents a so-called '''category''', a kind of grouping of related pages.
Поставити неки чланак у категорију тражи врло мало времена, а потенцијална корист за читаоца (разлог због којег је Википедија и створена) је велика -> уколико нека тема нема свој специјализовани попис важнијих чланака, категорија је једноставно решење. Зато се, сви они корисници Википедије који било да пишу нове артикле на Википедији или уређују постојеће, упућују да провере да ли чланак који уређују припада некој категорији. Уколико не припада, слободно га додају у одговарајућу категорију.
For example, this page belongs to "[[:Category:English documentation]]".
When a page belongs to one or more categories, this information appears at the bottom of the page (or in the upper-right corner, depending on the [[Help:Preferences|skin]] being used).


The page of the category contains text that can be edited, like any other page, but when displaying the page, the last part of what is displayed is an automatically generated, alphabetical list of all pages in that category, in the form of links (in fact ASCII order, see [[Help:Special page]]).


For a complete list of categories, see [[Special:Categories]]. Individual wikis may have their own top-level categories, such as [[w:Category:Categories]] in Wikipedia. For categories in Meta-Wiki, see [[m:Meta:Categories]].
== Упутство за прављење категорија ==


New categories can be [[Help:Starting a new page|created]] and [[Help:Editing|edited]] in the same way as any other regular page, but when displayed, an automatically generated, alphabetical list of all pages in that category appears at the bottom.
===Историја категорија===
"У овом тренутку (фебруар 2004.) наша Википедија има 418 категорија, у односу на Википедију на енглеском језику која има знатно већи број. Број категорија на енглеској Википедији је велик и претеран, јер има понекад и пет различитих категорија за једну годину, а поседује категорије за све године од 1. до данас. Смерница би могла да буде не креирати категорију ако ће у њој бити мање од пет чланака, и стварати смислене категорије, нпр. "Главни градови" или "Градови Србије" су добри примери, "200 рођења", "200 смрти" "200" су лоши примери, јер како утврдити ко се родио, умро или што се уопште догодило 200-те године наше ере или пре Христа?"


You can assign a category to a page simply by adding "<nowiki>[[</nowiki>Category:''categoryname'']]" to the page's [[Help:Filling the page|wikitext]] source. Substitute the actual name of the category in place of ''categoryname''.
===Главне смернице===
*Уколико на Википедији постоји десетак или више чланака неког подручја који не припадају ниједној категорији, то представља довољан разлог за стварање нове категорије, пример су зодијачки знаци, има их 12 и сасвим је исправно за њих створити посебну категорију.
*Уколико нека постојећа категорија прерасте 50, 100 или 200 чланака, време је да се размотри њено дељење/стварање нових категорија. Неке категорије је лако поделити, неке није. Пример је ако пишете чланак о фудбалеру неке земље ставићете га у општу категорију [[:Категорија:Фудбалери]] али ако пишете о некој репрезентацији или клубу и желите да опишете више играча у посебним артиклима, сасвим је оправдано направити категорију например [[:Категорија:Фудбалер (Уругвај)]], а њу ставити у категорију фудбалери, али немојте да фудбалери буду усамљени у својим категоријама по земљама, односно да буде по два три фудбалера у категорији. Боље их је све ставити заједно у једну.


To be specific, in order to add an article called "Albert Einstein" to the category "People", you would edit the article and add "<nowiki>[[</nowiki>Category:People]]" (no quotes) into its page source somewhere. Exactly where doesn't matter, but the Wikipedia policy, for example, is to put it ''after'' the article text, but ''before'' any [[Help:Interwiki linking|interlanguage links]].


==Category page==
*НЕ креирати категорију ако ће у њој бити мање од пет чланака (нпр. категорија '''Круг као математички појам''' има ће највише два чланка: круг и кружница)
A category page consists of:
*НЕ креирати категорију ако у њој има мање од пет чланака (нпр. категорија '''Бразил''' може имати на стотине чланака, но док је на српској Википедији један једини микро-чланак о Бразилу, таква категорија нам не треба)
*editable text
*НЕ креирати бесмислене категорије (горњи пример '''200 рођења''' добро осликава ситуацију, јер можемо бити сигурни да се те године родило много људи, неки су можда чак били и значајни, но који су то?)
*list of subcategories; how many there are is also displayed; if there are no subcategories the header and count are not shown.
*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."
** From [[m:MediaWiki 1.5|MediaWiki 1.5]] the namespace prefix is no longer shown.
*list of images with thumbnails (how many there are is not counted); the first 20 characters of the image name are shown, with an ellipsis if that is not the full name; also the file size is shown. As opposed to the second and third section, this section does not have subheaders per letter, it has not even a header itself and visually seems to fall under the header of the previous section "Articles in category ...", even though in counting the articles, images/image pages are not considered articles).


To create a category page, you must add a colon in front of the Category tag when you set up the page-creation link, to prevent the software from thinking you merely want to add the page you are working from to the category:
===Сортирање унутар категорије===
Уколико желите да се чланци сортирају само по имену немате никаквих проблема упишите је на следећи начин
'''<nowiki>[[Категорија:Име_категорије]]</nowiki>''' али ако желите да неки текстови буду лакше доступни , пример попис раса паса и класификација онда примењујете мали трик '''<nowiki>[[Категорија:Име_категорије|!]]</nowiki>'''. Обратите пажњу на положај знака узвика: иза имена категорије иде усправна црта па пример у овом случају знак узвика. То аутоматски издваја артикл на почетак стране. погледај пример '''[[:Категорија:Расе паса]]'''. Приметићете да иде прво знак узвика па звездица па остали карактери.


<nowiki>[[</nowiki>:Category:''Category name'']]
'''Попис редоследа важности по карактерима:'''


Placing the above text on working page will create the link you can use to edit your category page.
*!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_'abcdefghijklmnopqrstuvwxyz{|}~


The items in the lists all link to the pages concerned; in the case of the images this applies both to the image itself and to the text below it (the name of the image).
*Као што сте могли приметити иде прво знак узвика. Међутим, мора да се напомене да испред њега иде у сортирању празно место, значи ако после усправне црте оставите празно, па затворите заграде, чланак ће бити на првом месту испред свих.
*Разне су могућности али предлажемо да овде користите '''*''' (звездицу) и '''!''' (знак узвика) као основне карактере приликом сортирања, а све због лакше употребе шаблона садржаја о коме ће бити речи у следећем делу.


The first and second list each have a header for each first character, dispensed with if there are no entries for a header.
== Табела садржај у категоријама ==


On Meta and Wikipedia a redirect to a category shows the editable text only. To get the full page after being redirected, use the link "Image", or "Category", respectively.
Уколико у некој категорији има више од 200 артикала , садржај категорије се смешта на више страна, што отежава проналажење одређеног чланка који почиње на неко слово које није излистано на почетку. Зато се у врх ставља садржај са словима и левим кликом на тражено слово добићете излистане све чланке који се налазе у категорији, а почињу одређеним словом. Пример можете видети у врху ове стране '''[[:Категорија:Расе паса]]'''.


On Commons a redirect to a category gives the full page, but not the subcategories and pages in the redirect page (if that is also a category).
* Табелу садржај у категоријама није тешко поставити само упишите на врх стране '''<nowiki>{{Садржај категорије}}</nowiki>''', наравно са великим заградама, и табела ће се сама поставити, што ће олакшати претраживање велике категорије.


==Sort order==
== Како пратити промене у одређеној категорији==
The system uses [[Help:Alphabetic order|alphabetical order]] or more precisely Unicode order for pages in categories. The range 32-127 corresponds to [[w:ASCII|ASCII]], for more see a [[s:Transwiki:Table of Unicode characters, 128 to 999|table of Unicode characters]]:
<div align="center"><pre>
!"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
'abcdefghijklmnopqrstuvwxyz{|}~&#127;</pre></div>
Note in particular that "Z" comes before "a", and "z" before accented / umlauted characters.
The blank space within a page name is treated as an underscore, and therefore comes after the capitals, and before the lower case letters.
However, a "blank space" after the name comes before any character.
Thus we have the order PC, PCX, PC Bruno, PCjr.


:''See also [[Help:special characters|special characters]], [[m:Pages starting with a special character|Pages starting with a special character]], [[w:en:Latin_alphabet#Collating_in_other_languages|collating]]''.
Уколико сте специјализовани писац за одређену категорију и или само љубитељ одређене теме добро је знати како да пратите промене само у једној категорији. Например категорија '''[[:Категорија:Расе паса]]''' (није обавезно да буде та) могу бити писци и или лептирови, али да би избегли гужву са основне стране скорих промена где може да буде и више стотина промена у једном дану, погледајте решење за тај проблем: '''[[Разговор:Класификација раса по азбучном реду]]'''. Овде ћете видети компликовану страну за праћење промена у чланцима о псима на више језика. Сада можете да пратите ко је шта мењао или додавао на вашим омињеним текстовима и то издвојено по категоријама. Нема потребе за свим оним језицима то је само био пример. Постоји и страна која се зове ''моја листа надгледања'' али она је за већу групу артикала. Овај начин је уско специјализован. Није лош ни за праћење вандализма на одређеној групи артикала.


=== Sort key ===
*Пример како се пише можете ископирати одавде само упишите вашу адресу, коју желите да пратите, и име линка, како хоћете да се пречица види, али без наводника.
Each of the three lists is in the order explained above. If you want an item in a list to be positioned in that order, based on an alternative name (sort key) for that item, then this can be specified in the category tag that places the item in the list:


<nowiki>[[</nowiki>Category:''category name''|''sort key'']]
** <nowiki>[http://sr.wikipedia.org/w/index.php?title=Special:Recentchangeslinked&target=Категорија: '''Овде упиши име категорије без наводника'''&hideminor=0&days=30&limit=500 '''Овде упиши како хоћеш да линк буде видљив, без наводника''']</nowiki>


For example to add an article called Albert Einstein to the category "people" and have the article sorted by "Einstein, Albert". You would type "<nowiki>[[Category:People|Einstein, Albert]]</nowiki>".
**Овако то изгледа [http://sr.wikipedia.org/w/index.php?title=Special:Recentchangeslinked&target=Категорија:Расе_паса&hideminor=0&days=30&limit=500 Линк за праћење промена на текстовима који су повезани на категорију]


Although this is like the syntax for a [[Help:Piped link|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. Also, a piped link influences the rendering of the page itself, while a sort key affects the rendering of another page.
*&limit=500 , ако замените број 500 са неким другим до 2000 добићете толико задњих промена који сте број уписали, исто важи и за број дана уназад колико ће приказивати промене.


The displayed name is not changed, and, unfortunately, only visible on the edit pages of the members of the category. An explanation of the sort key system used can be useful on the editable part of a category page.
***Није лоше на своју страну поставити такве линкове како би са једног места лако пратили промене на артиклима за које се интересујете, без обзира колико често посећујете Википедију.


The sort key system should be obvious, otherwise the order seems random and items are hard to find. The system should either be consistently applied to all members of a category, or be such that the listings of members on which it is applied fit in well within the list of members for which no sort key is used. The latter is advisable for large, growing categories with many contributors. See also below.
=== Најчешће грешке у коришћењу категорија ===


A common system is starting with the last name, then a comma and a space, and then the first name; note that any additions such as "Jr." should come at the end, otherwise the entry would come before the same without the addition, because a space comes before a comma.
*Нови Вики софтвер искључујње могућност да се категорија категорише са истом категоријом којој и она припада, зато Вас молимо да и Ви водите мало рачуна о томе.


In e.g. [[w:Category:Denmark]], the sort key of a page consists of the keywords, without "Danish" or "of Denmark", "in Denmark", etc.
=== Погледајте ===
*[[meta:Help:Category]] Страницу о категоријама на Мети.


The sort key is case sensitive, so a page with the tag <nowiki>[[Category:</nowiki>''Foo''<nowiki>|</nowiki>Zealand]] is sorted before one with the tag <nowiki>[[Category:</nowiki>''Foo''<nowiki>|</nowiki>amsterdam]]. This can be inconvenient, requiring a sortkey in projects with case-sensitivity of the first character if one wants the A and the a together, but it may also be used to one's advantage: e.g., it allows sorting of the pages into two groups, one put in the range A-Z and one in a-z, using sortkeys; see e.g. [[:Category:Demo]], where the help pages are put separately by using sortkeys with lower-case "h".
=== Где питати===
*'''[[Википедија:Трг|Трг]]''' је право место за постављање питања о категоријама.


To get the order right, be consistent in punctuation and spacing. For example, "A Z" with two blank spaces comes before "A A" with one.
== Како обрисати категорију ==


An underscore in a page name is equivalent with, and treated as a blank space. However, an underscore in a sort key is distinct from a blank space.
[[Категорија:Помоћ]]


As seen from the ASCII sequence above, forcing items to the beginning or end can be done with a sort key starting with a space or ~, respectively. Another common sort key for the beginning of the list is the asterisk (*).
[[be:&#1042;&#1110;&#1082;&#1110;&#1087;&#1101;&#1076;&#1099;&#1103;:&#1043;&#1110;&#1077;&#1088;&#1072;&#1088;&#1093;&#1110;&#1103;]]

[[ca:Viquipèdia:Categorització]]
===Sort key of images===
[[da:Wikipedia:Kategorisering]]
Images without sort key are alphabetized according the full name, including namespace prefix "Image:". Therefore, for images for which a sort key is used, the prefix should also be included, otherwise these images are positioned on the category page before "Image:A" or after "Image:Z". Alternatively, ''all'' images can be given a sort key.
[[de:Wikipedia:Kategorien]]

[[el:&#914;&#953;&#954;&#953;&#960;&#945;&#943;&#948;&#949;&#953;&#945;:&#922;&#945;&#964;&#951;&#947;&#959;&#961;&#953;&#959;&#960;&#959;&#943;&#951;&#963;&#951;]]
Thus a list of images may show a sequence A-I, A-Z, I-Z. One may choose to fix the first and third sequence by adding the prefix to the sort keys, or the second sequence, by putting sort keys without prefix.
[[en:Wikipedia:Categorization]]

[[fr:Wikipédia:Catégorie]]
Similar remarks apply for other non-main namespaces. However, the category namespace is an exception: the default sort key is without prefix, to avoid listing all subcategories by default under the C. Therefore, explicit sort keys should also be without prefix.
[[it:Wikipedia:Discussione/Categorie]]

[[ja:Wikipedia:&#12459;&#12486;&#12468;&#12521;&#12452;&#12476;&#12540;&#12471;&#12519;&#12531;]]
===Grouping of pages by using sortkeys===
[[ko:&#50948;&#53412;&#48177;&#44284;:&#52852;&#53580;&#44256;&#47532;]]
If e.g. in a list of people sortkeys like "scientist Einstein, Albert" are used then all scientists are listed together under the "s". Unfortunately no separate heading "scientist(s)" is possible, and salesmen would be under the same heading. Alternatively "scientist" can have e.g. code K (to be explained in the editable part of the category page) and the sortkey "K Einstein, Albert" is used.
[[lb:Wikipedia:Kategorien]]

[[nl:Wikipedia:Categorieën]]
===Labels in the list of images===
[[pl:Wikipedia:Kategoryzacja]]
As mentioned above, the first 20 characters of the image name are shown, with dots if that is not the full name. This can be inconvenient, e.g. in [[commons:Category:William-Adolphe Bouguereau]] most images have a name starting with "William-Adolphe Bouguereau (1825-1905) -", which are therefore all labeled "William-Adolphe Boug..." (see the last section of the category page).
[[sl:Wikipedija:Kategorizacija]]

[[sv:Wikipedia:Lista över ämnesgrupper]]
The full names are only shown in the hover box and the status bar, depending on the browser; in the latter possibly with codes such as "%28" for "(".
[[zh:Wikipedia:&#39029;&#38754;&#20998;&#31867;]]

Thus, looking up a name in the alphabetic list is cumbersome. It might have been better to start the names with the shorter "Bouguereau, " and then the title of the painting (unless the software will be improved later).

==Using templates to populate categories==

If a template contains the code indicating that it is in a category, this does not only put that template in the category, but also the pages that include the template.

The page that contains the template correctly lists the categories to which it belongs. However, adding or deleting a category tag in the template does not add or delete the listings on the category page of pages that use the template, until some edit is made in the page that uses the template.

In other words:

*lists of categories a page is in, are up-to-date
*lists of pages in a category are based on the situation just after the last edit of the pages

Since adding or removing a category or template tag is obviously an edit there is only a complication when a page is indirectly added to or deleted from a category, through a change in a template the page uses.

To refresh category pages with respect to the listing of a particular page (adding or deleting the entry), a [[Help:Dummy_edit|null edit]] can be applied to that page: just applying section edit and saving without changes.

===Sort key===
A sort key in a category tag in a template applies to the template as well as to the pages that use it, so it is only useful if it is variable. It can depend on a [[Help:Variable|variable]] (notably PAGENAME), parameter, or the content of a template.

===Categorizing templates themselves===
To categorize templates themselves, without the pages that call them, one could consider putting the category tag in the talk page of the template, and an explanation on the category page that the template talk pages listed are meant as categorization of the templates.

Another way of doing this is using the <nowiki><noinclude></nowiki> tag. Example: <pre><noinclude>[[Category:category name]]</noinclude></pre>

Which is more convenient in use depends on whether one wants, from the category page, easy access to the talk page or to the template page, and conversely: whether one wants easy access to the category page from the template talk page or from the template page.

===Excluding templates from categories===
Use: <pre><includeonly></pre> to keep a template from showing up in a category. Text between <pre><includeonly></pre> and <pre></includeonly></pre> will be processed and displayed only when the page is being included. The obvious application is:

* Adding all pages containing a given template to a category

Note that the usual update problems apply -- if you change the categories inside a template, the categories of the referring pages won't be updated until those pages are edited.

==Comparison with "What links here"==

[[Help:What links here|Backlinks]] are often used as a by-product of links. However, links can be put specially for the backlinks, just like category tags are. In that case a redirect corresponds to a supercategory.

Advantages of categories:
*Category listings are alphabetical, for "What links here" this typically applies for the first part only, for the pages already linking to the given page at the time of the last rebuilding of the link tables in the database.
*Categories have an editable part (however, there is anyway a talk page)
*A category can have multiple supercategories

Advantage of a pseudo-category system using backlinks:
*Backlinks can show a tree structure: not only pages and subcategories, but also the contents of the subcategories (for each a list of pages and a list of sub-subcategories) and the contents of the sub-subcategories (for each a list of pages and a list of sub-sub-subcategories), but not the contents of the sub-sub-subcategories, up to three levels are shown; see [[Special:Whatlinkshere/Altcat:Help|Cat:Help]] and [[w:en:Special:Whatlinkshere/Cat:Municipalities of the Netherlands|Cat:Municipalities of the Netherlands]].

Alternatively a template (either a dummy one, specially for this purpose, or one with contents) can function as a supercategory, used in connection with backlinks. In that case:
*also multiple supercategories are possible
*combined content of subcategories is shown in one list, not grouped by subcategory (the tree structure is not shown, but it can be used by taking the backlinks at a lower node, showing the smaller set)
*the restriction of three levels (in the case of using redirects) does not apply; for example page Aijkl in the category Aijk in the category Aij in the category Ai in the category A (represented by Aijkl calling template Aijk, etc.) can be shown in the list of pages in category A (the backlinks of template A).

"What links here" tends to be a by-product of links that are useful anyway (although links may be put with this use in mind), while category links are put specially to produce a category page.

Putting a category tag on a test page, user page, etc. (also if done indirectly by including a template with a category tag) is considered to pollute the category, while regular links from such pages showing up in "what links here" is considered harmless.

Therefore:
*when copying text to such pages, category tags have to be removed; alternatively, convert the category to a link by adding a leading colon after the brackets. For example, <nowiki>"[[:Category:Art]]"</nowiki> is a link to the category, ''not'' an assignment to a category.
*when including a template that is in a category, do not use the template feature, but use "subst" or copy-and-paste, and delete the category tags.

===Applying "Related Changes" to a category===

For the "What links here" feature, only the links in the editable part of the page count, not the links to the pages in the category.

For a category, the "[[Help:Related changes|Related Changes]]" feature gives the changes in the pages in the category (according to the current category page, so excluding the pages that have potentially been added and including those that have potentially been removed, through addition or deletion of a template to/from the category, as explained above)
*for subcategories: the changes in their editable parts only
*for images (image pages): the changes in their editable parts only.

It does ''not'' show the changes in pages linked from the editable parts of the category. Possible workarounds:
*The editable part can be put in a template. The category tags (which have no effect on Related Changes anyway) can better be kept out of the template, because on the pages of these supercategories the template would be listed under the articles in those categories. Whether interwiki links (with or without interlanguage link feature) are in the template or not does not make a difference, provided that the template is not used elsewhere.
*Related Changes is applied to a page that calls the category as a template: <nowiki>{{:Category:</nowiki>''Category name''}}; only the editable part is included in the page; the page could be specially created for this purpose and call multiple categories. However, this page will then be listed in the supercategory pages of each category.

As usual (but as opposed to a watchlist) the changes in the corresponding talk pages are not shown.

Applying "Related Changes" to a category, with sufficiently high limits on number and days, is also useful for checking which pages in a category one [[Help:Watching pages|"watches"]]: they are bolded.

===Detection of additions to a category===
With "Related Changes" one can find pages which are newly in a category due to addition of a category tag or the tag of a template that is in the category. Addition of pages through addition to the category of a template is seen indirectly: one can see the change in the template, and then check which pages call the template. This even shows pages which are only potentially in the category (see above).

Unfortunately there is no similar way to detect a deletion from a category.

==Category considerations==
Each page is typically in at least one category. It may be in more, but it may be wise not to put a page in a category and also in a more general category.

Each category, except one top-level category, is typically in at least one higher level category.

Check the conventions in a project and make yourself familiar with the categories in use before assigning pages and subcategories to categories and before creating new categories.

=== Linking to a category ===

If you want to link to a category without the current page being added to it, you should use the link form <nowiki>[[:Category:</nowiki>''foobar''<nowiki>]]</nowiki> (where ''foobar'' is the category name). Note the extra ''':''' before Category.

===Alternatives for overviews===
An overview of links to pages and of images (by means of thumbnails) can be put in the editable part of a category, just like in any page, or be generated in the second, third and fourth part of the category page.

The first gives control on structure and lay-out. For example, in the editable part of [[commons:Category:William-Adolphe Bouguereau]] the name of the painter does not have to be repeated, and the full titles of the paintings can be shown.

The second is more convenient for new pages/images: by putting the category tag (which for images can even be done in the [[Help:Edit summary#Upload_summary|upload summary]]) the overview is automatically updated. Also, the sorting in alphabetic order is automatic in the second case.

A category page may have an overview in the first part, as well as in one or more of the other parts, with the following possibilities:
*items occur twice, but ordered and structured differently, with different info (including that the fourth section shows the file sizes); when creating/uploading new items, they can be put in the category first, which is a convenient intermediate stage for updating the editable part
*avoiding duplications

Anyway, a category has the double functionality of allowing extension of the overviews both from the overview page and from the member pages. This convenience makes it easier to build and maintain a complete overview (albeit divided over sections) for the subject concerned.

If the second, third and fourth part of the category page are not used, then the category page is much like a page in another namespace. Differences are:
*the name starts with "Category:"
*in ordinary links to the category page the name is preceded by a colon
*Related Changes does not work for the editable part

If a category is growing too large, it is cumbersome to split. When new items need to be added, and they are on a subtopic about which there is still little in the category, this is a good occasion to start a subcategory. Other kinds of overview can be split more easily.

See also [[commons:Commons:Images on normal pages or categories:Vote]].

=== Subcategories ===
Creating subcategories takes only a few additional steps. Adding a category tag to a category page makes the edited category a subcategory of the category specified in the tag.

First create a new category page for the subcategory the same way you would make a regular category.
For example, create <nowiki>[[Category:Soccer]]</nowiki>.

Then go to the newly created category page and edit it. Add the category tag for the parent category (e.g. <nowiki>[[Category:Sports]]</nowiki>) to the page.

In this example, the Soccer category would then be a subcategory of the Sports category.
For a live example see [[:Category:Demo_1]] which is a subcategory of [[:Category:Demo]].

===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 an article page.

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

Redirecting a category page is possible, but almost certainly won't have the desired effect (it can be abused for other purposes).

{{h:f|langs=|enname=Category}}

Revision as of 22:17, 6 June 2006

A category is a software feature of MediaWiki. Categories provide automatic indexes, that are useful as tables of contents. Together with links and templates they structure a project.

Putting an item in a category

A page in any namespace can be put in a category by adding a category tag to the page (by convention, at the end of the page), e.g.:

[[Category:Category name]]

This 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. These links do not appear at the location where you inserted the tag, but at the page margin in a fixed place, depending on the skin (the bottom for Monobook, the upper right corner for Standard). 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 the automatic ordering of lists in the category pages themselves (see below).

Executive summary

Each of the pages in the Category namespace represents a so-called category, a kind of grouping of related pages. For example, this page belongs to "Category:English documentation". When a page belongs to one or more categories, this information appears at the bottom of the page (or in the upper-right corner, depending on the skin being used).

The page of the category contains text that can be edited, like any other page, but when displaying the page, the last part of what is displayed is an automatically generated, alphabetical list of all pages in that category, in the form of links (in fact ASCII order, see Help:Special page).

For a complete list of categories, see Special:Categories. Individual wikis may have their own top-level categories, such as w:Category:Categories in Wikipedia. For categories in Meta-Wiki, see m:Meta:Categories.

New categories can be created and edited in the same way as any other regular page, but when displayed, an automatically generated, alphabetical list of all pages in that category appears at the bottom.

You can assign a category to a page simply by adding "[[Category:categoryname]]" to the page's wikitext source. Substitute the actual name of the category in place of categoryname.

To be specific, in order to add an article called "Albert Einstein" to the category "People", you would edit the article and add "[[Category:People]]" (no quotes) into its page source somewhere. Exactly where doesn't matter, but the Wikipedia policy, for example, is to put it after the article text, but before any interlanguage links.

Category page

A category page consists of:

  • editable text
  • list of subcategories; how many there are is also displayed; if there are no subcategories the header and count are not shown.
  • 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."
  • list of images with thumbnails (how many there are is not counted); the first 20 characters of the image name are shown, with an ellipsis if that is not the full name; also the file size is shown. As opposed to the second and third section, this section does not have subheaders per letter, it has not even a header itself and visually seems to fall under the header of the previous section "Articles in category ...", even though in counting the articles, images/image pages are not considered articles).

To create a category page, you must add a colon in front of the Category tag when you set up the page-creation link, to prevent the software from thinking you merely want to add the page you are working from to the category:

[[:Category:Category name]]

Placing the above text on working page will create the link you can use to edit your category page.

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

The first and second list each have a header for each first character, dispensed with if there are no entries for a header.

On Meta and Wikipedia a redirect to a category shows the editable text only. To get the full page after being redirected, use the link "Image", or "Category", respectively.

On Commons a redirect to a category gives the full page, but not the subcategories and pages in the redirect page (if that is also a category).

Sort order

The system uses alphabetical order or more precisely Unicode order for pages in categories. The range 32-127 corresponds to ASCII, for more see a table of Unicode characters:

 !"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
'abcdefghijklmnopqrstuvwxyz{|}~&#127;

Note in particular that "Z" comes before "a", and "z" before accented / umlauted characters. The blank space within a page name is treated as an underscore, and therefore comes after the capitals, and before the lower case letters. However, a "blank space" after the name comes before any character. Thus we have the order PC, PCX, PC Bruno, PCjr.

See also special characters, Pages starting with a special character, collating.

Sort key

Each of the three lists is in the order explained above. If you want an item in a list to be positioned in that order, based on an alternative name (sort key) for that item, then this can be specified in the category tag that places the item in the list:

[[Category:category name|sort key]]

For example to add an article called Albert Einstein to the category "people" and have the article sorted by "Einstein, Albert". You would type "[[Category:People|Einstein, Albert]]".

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. Also, a piped link influences the rendering of the page itself, while a sort key affects the rendering of another page.

The displayed name is not changed, and, unfortunately, only visible on the edit pages of the members of the category. An explanation of the sort key system used can be useful on the editable part of a category page.

The sort key system should be obvious, otherwise the order seems random and items are hard to find. The system should either be consistently applied to all members of a category, or be such that the listings of members on which it is applied fit in well within the list of members for which no sort key is used. The latter is advisable for large, growing categories with many contributors. See also below.

A common system is starting with the last name, then a comma and a space, and then the first name; note that any additions such as "Jr." should come at the end, otherwise the entry would come before the same without the addition, because a space comes before a comma.

In e.g. w:Category:Denmark, the sort key of a page consists of the keywords, without "Danish" or "of Denmark", "in Denmark", etc.

The sort key is case sensitive, so a page with the tag [[Category:Foo|Zealand]] is sorted before one with the tag [[Category:Foo|amsterdam]]. This can be inconvenient, requiring a sortkey in projects with case-sensitivity of the first character if one wants the A and the a together, but it may also be used to one's advantage: e.g., it allows sorting of the pages into two groups, one put in the range A-Z and one in a-z, using sortkeys; see e.g. Category:Demo, where the help pages are put separately by using sortkeys with lower-case "h".

To get the order right, be consistent in punctuation and spacing. For example, "A Z" with two blank spaces comes before "A A" with one.

An underscore in a page name is equivalent with, and treated as a blank space. However, an underscore in a sort key is distinct from a blank space.

As seen from the ASCII sequence above, forcing items to the beginning or end can be done with a sort key starting with a space or ~, respectively. Another common sort key for the beginning of the list is the asterisk (*).

Sort key of images

Images without sort key are alphabetized according the full name, including namespace prefix "Image:". Therefore, for images for which a sort key is used, the prefix should also be included, otherwise these images are positioned on the category page before "Image:A" or after "Image:Z". Alternatively, all images can be given a sort key.

Thus a list of images may show a sequence A-I, A-Z, I-Z. One may choose to fix the first and third sequence by adding the prefix to the sort keys, or the second sequence, by putting sort keys without prefix.

Similar remarks apply for other non-main namespaces. However, the category namespace is an exception: the default sort key is without prefix, to avoid listing all subcategories by default under the C. Therefore, explicit sort keys should also be without prefix.

Grouping of pages by using sortkeys

If e.g. in a list of people sortkeys like "scientist Einstein, Albert" are used then all scientists are listed together under the "s". Unfortunately no separate heading "scientist(s)" is possible, and salesmen would be under the same heading. Alternatively "scientist" can have e.g. code K (to be explained in the editable part of the category page) and the sortkey "K Einstein, Albert" is used.

Labels in the list of images

As mentioned above, the first 20 characters of the image name are shown, with dots if that is not the full name. This can be inconvenient, e.g. in commons:Category:William-Adolphe Bouguereau most images have a name starting with "William-Adolphe Bouguereau (1825-1905) -", which are therefore all labeled "William-Adolphe Boug..." (see the last section of the category page).

The full names are only shown in the hover box and the status bar, depending on the browser; in the latter possibly with codes such as "%28" for "(".

Thus, looking up a name in the alphabetic list is cumbersome. It might have been better to start the names with the shorter "Bouguereau, " and then the title of the painting (unless the software will be improved later).

Using templates to populate categories

If a template contains the code indicating that it is in a category, this does not only put that template in the category, but also the pages that include the template.

The page that contains the template correctly lists the categories to which it belongs. However, adding or deleting a category tag in the template does not add or delete the listings on the category page of pages that use the template, until some edit is made in the page that uses the template.

In other words:

  • lists of categories a page is in, are up-to-date
  • lists of pages in a category are based on the situation just after the last edit of the pages

Since adding or removing a category or template tag is obviously an edit there is only a complication when a page is indirectly added to or deleted from a category, through a change in a template the page uses.

To refresh category pages with respect to the listing of a particular page (adding or deleting the entry), a null edit can be applied to that page: just applying section edit and saving without changes.

Sort key

A sort key in a category tag in a template applies to the template as well as to the pages that use it, so it is only useful if it is variable. It can depend on a variable (notably PAGENAME), parameter, or the content of a template.

Categorizing templates themselves

To categorize templates themselves, without the pages that call them, one could consider putting the category tag in the talk page of the template, and an explanation on the category page that the template talk pages listed are meant as categorization of the templates.

Another way of doing this is using the <noinclude> tag. Example:

<noinclude>[[Category:category name]]</noinclude>

Which is more convenient in use depends on whether one wants, from the category page, easy access to the talk page or to the template page, and conversely: whether one wants easy access to the category page from the template talk page or from the template page.

Excluding templates from categories

Use:

<includeonly>

to keep a template from showing up in a category. Text between

<includeonly>

and

</includeonly>

will be processed and displayed only when the page is being included. The obvious application is:

  • Adding all pages containing a given template to a category

Note that the usual update problems apply -- if you change the categories inside a template, the categories of the referring pages won't be updated until those pages are edited.

Comparison with "What links here"

Backlinks are often used as a by-product of links. However, links can be put specially for the backlinks, just like category tags are. In that case a redirect corresponds to a supercategory.

Advantages of categories:

  • Category listings are alphabetical, for "What links here" this typically applies for the first part only, for the pages already linking to the given page at the time of the last rebuilding of the link tables in the database.
  • Categories have an editable part (however, there is anyway a talk page)
  • A category can have multiple supercategories

Advantage of a pseudo-category system using backlinks:

  • Backlinks can show a tree structure: not only pages and subcategories, but also the contents of the subcategories (for each a list of pages and a list of sub-subcategories) and the contents of the sub-subcategories (for each a list of pages and a list of sub-sub-subcategories), but not the contents of the sub-sub-subcategories, up to three levels are shown; see Cat:Help and Cat:Municipalities of the Netherlands.

Alternatively a template (either a dummy one, specially for this purpose, or one with contents) can function as a supercategory, used in connection with backlinks. In that case:

  • also multiple supercategories are possible
  • combined content of subcategories is shown in one list, not grouped by subcategory (the tree structure is not shown, but it can be used by taking the backlinks at a lower node, showing the smaller set)
  • the restriction of three levels (in the case of using redirects) does not apply; for example page Aijkl in the category Aijk in the category Aij in the category Ai in the category A (represented by Aijkl calling template Aijk, etc.) can be shown in the list of pages in category A (the backlinks of template A).

"What links here" tends to be a by-product of links that are useful anyway (although links may be put with this use in mind), while category links are put specially to produce a category page.

Putting a category tag on a test page, user page, etc. (also if done indirectly by including a template with a category tag) is considered to pollute the category, while regular links from such pages showing up in "what links here" is considered harmless.

Therefore:

  • when copying text to such pages, category tags have to be removed; alternatively, convert the category to a link by adding a leading colon after the brackets. For example, "[[:Category:Art]]" is a link to the category, not an assignment to a category.
  • when including a template that is in a category, do not use the template feature, but use "subst" or copy-and-paste, and delete the category tags.

Applying "Related Changes" to a category

For the "What links here" feature, only the links in the editable part of the page count, not the links to the pages in the category.

For a category, the "Related Changes" feature gives the changes in the pages in the category (according to the current category page, so excluding the pages that have potentially been added and including those that have potentially been removed, through addition or deletion of a template to/from the category, as explained above)

  • for subcategories: the changes in their editable parts only
  • for images (image pages): the changes in their editable parts only.

It does not show the changes in pages linked from the editable parts of the category. Possible workarounds:

  • The editable part can be put in a template. The category tags (which have no effect on Related Changes anyway) can better be kept out of the template, because on the pages of these supercategories the template would be listed under the articles in those categories. Whether interwiki links (with or without interlanguage link feature) are in the template or not does not make a difference, provided that the template is not used elsewhere.
  • Related Changes is applied to a page that calls the category as a template: {{:Category:Category name}}; only the editable part is included in the page; the page could be specially created for this purpose and call multiple categories. However, this page will then be listed in the supercategory pages of each category.

As usual (but as opposed to a watchlist) the changes in the corresponding talk pages are not shown.

Applying "Related Changes" to a category, with sufficiently high limits on number and days, is also useful for checking which pages in a category one "watches": they are bolded.

Detection of additions to a category

With "Related Changes" one can find pages which are newly in a category due to addition of a category tag or the tag of a template that is in the category. Addition of pages through addition to the category of a template is seen indirectly: one can see the change in the template, and then check which pages call the template. This even shows pages which are only potentially in the category (see above).

Unfortunately there is no similar way to detect a deletion from a category.

Category considerations

Each page is typically in at least one category. It may be in more, but it may be wise not to put a page in a category and also in a more general category.

Each category, except one top-level category, is typically in at least one higher level category.

Check the conventions in a project and make yourself familiar with the categories in use before assigning pages and subcategories to categories and before creating new categories.

Linking to a category

If you want to link to a category without the current page being added to it, you should use the link form [[:Category:foobar]] (where foobar is the category name). Note the extra : before Category.

Alternatives for overviews

An overview of links to pages and of images (by means of thumbnails) can be put in the editable part of a category, just like in any page, or be generated in the second, third and fourth part of the category page.

The first gives control on structure and lay-out. For example, in the editable part of commons:Category:William-Adolphe Bouguereau the name of the painter does not have to be repeated, and the full titles of the paintings can be shown.

The second is more convenient for new pages/images: by putting the category tag (which for images can even be done in the upload summary) the overview is automatically updated. Also, the sorting in alphabetic order is automatic in the second case.

A category page may have an overview in the first part, as well as in one or more of the other parts, with the following possibilities:

  • items occur twice, but ordered and structured differently, with different info (including that the fourth section shows the file sizes); when creating/uploading new items, they can be put in the category first, which is a convenient intermediate stage for updating the editable part
  • avoiding duplications

Anyway, a category has the double functionality of allowing extension of the overviews both from the overview page and from the member pages. This convenience makes it easier to build and maintain a complete overview (albeit divided over sections) for the subject concerned.

If the second, third and fourth part of the category page are not used, then the category page is much like a page in another namespace. Differences are:

  • the name starts with "Category:"
  • in ordinary links to the category page the name is preceded by a colon
  • Related Changes does not work for the editable part

If a category is growing too large, it is cumbersome to split. When new items need to be added, and they are on a subtopic about which there is still little in the category, this is a good occasion to start a subcategory. Other kinds of overview can be split more easily.

See also commons:Commons:Images on normal pages or categories:Vote.

Subcategories

Creating subcategories takes only a few additional steps. Adding a category tag to a category page makes the edited category a subcategory of the category specified in the tag.

First create a new category page for the subcategory the same way you would make a regular category. For example, create [[Category:Soccer]].

Then go to the newly created category page and edit it. Add the category tag for the parent category (e.g. [[Category:Sports]]) to the page.

In this example, the Soccer category would then be a subcategory of the Sports category. For a live example see Category:Demo_1 which is a subcategory of Category:Demo.

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 an article page.

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

Redirecting a category page is possible, but almost certainly won't have the desired effect (it can be abused for other purposes).

Links to other help pages

Help contents
Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · Wikidata · MediaWiki · Wikibooks · Wikisource · MediaWiki: Manual · Google
Versions of this help page (for other languages see further)
What links here on Meta or from Meta · Wikipedia · MediaWiki
Reading
Go · Search · Namespace · Page name · Section · Backlinks · Redirect · Category · Image page · Special pages · Printable version
Tracking changes
Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
Logging in and preferences
Logging in · Preferences
Editing
Starting a new page · Advanced editing · Editing FAQ · Export · Import · Shortcuts · Edit conflict · Page size
Referencing
Links · URL · Interwiki linking · Footnotes
Style and formatting
Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · Lists · Table · Sorting · Colors · Images and file uploads
Fixing mistakes
Show preview · Reverting edits
Advanced functioning
Expansion · Template · Advanced templates · Parser function · Parameter default · Magic words · System message · Substitution · Array · Calculation · Transclusion
Others
Special characters · Renaming (moving) a page · Preparing a page for translation · Talk page · Signatures · Sandbox · Legal issues for editors