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.

Hogyan helyezz el egy lapot egy kategóriában szerkesztés

Bármelyik névtérbeli lapot lehelyezhetsz egy kategóriában, ha beírod a lapra a kategóriahivatkozást (a konvenció szerint a lap végére), így:

[[Kategória:Kategória neve]]

Ez automatikusan listázza a lapot a megfelelő kategória lapján, és elhelyez egy linket a kategória (a Kategória: névtérben levő) lapjára a lap alján. Egy lapot több kategóriába is be lehet rakni, több kategóriahivatkozással. Ezek a linkek nem ott jelennek meg, ahova beszúrtad őket, hanem a lap szegélyén egy fix helyen, ez a hely a felülettől függ (a lap alján az alapértelmezett Monobookban, a jobb felső sarokban az Alap skinben). A kategóriahivatkozásokat bárhol el lehet helyezni a lapon, de rendszerint a lap végén vannak, hogy elkerüljék a nemkívánatos megjelenítési formázásokat. A kategóriák linkjei olyan sorrendben jelennek meg a lapon, amilyen sorrendben a cikkben előfordulnak, nem úgy mint az automatikus rendezésnél a kategória lapjén (lásd lent).

Összefoglaló szerkesztés

Minden egyes lap a Kategória névtérben képvisel egy úgynevezett kategóriát, ami összetartozó lapok csoportosításának formája. Például ez a lap a „Kategória:Segítség”-be tartozik. Ha egy lap egy vagy több kategóirába tartozik, akkor ez megjelenik a lap alján (vagy a jobb felső sarokban, a használt felülettől függően).

A kategória lapja tartalmaz szöveget, amit úgy lehet szerkeszteni, mint bármely más lap szövegét. Amikor viszont megnézzük a lapot, akkor az utolsó részén egy automatikusan létrehozott, betűrendes lista jelenik meg a kategóriába tartozó lapokról linkek formájában (valójában ASCII sorrendben, lásd m:Help:Special pages).

A kategóriák teljes listájáért lásd: Speciális:Kategóriák. A legfelsőbb szintű kategória a Kategória:Kategóriák.

Az új kategóriák létrehozhatók és szerkeszthetők ugyanúgy mint bármelyik közönséges lap, de mikor megjelennek, egy automatikusan létrehozott, betűrendes lista látható a lap alján a kategóriába tartozó lapokról.

Egy lapot egy kategóriába tehetsz egyszerűen a "[[Kategória:kategórianév]]" hozzáadásával a lap wikikód forrásához. Cseréld le a kategórianév szót a megfelelő kategória nevére.

Egy konkrét példa: ha az "A borozó" című cikket szeretnéd a "Versek" kategóriába tenni, akkor szerkeszd a cikk lapját és írd be valahova a lap forrásába ezt: „[[Kategória:Versek]]” (idézőjelek nélkül), aztán mentsd el. Az nem lényeges, hogy a forrásban hova írod, de a szöveg alá, a nyelvközi linkek elé szokás.

Ha csak egy közönséges, egy kategóriára mutató linket szeretnél egy lapon elhelyezni (anélkül hogy a lap a kategóriába kerülne) tegyél egy kettőspontot a névtér elé. Például:

[[:Kategória:Nincs ebben a kategóriában]]

Kategória lapja szerkesztés

Egy kategória lapja a következőket tartalmazza:

  • Szerkeszthető szöveg
  • Az alkategóriák listája, az alkategóriák száma; ha nincs egy alkategória sem, akkor a számláló is el van rejtve. Ha valamelyik alkategória előtti „+” jelre kattintasz, láthatod a kiválasztott alkategória alkategóriáit.
  • Lista a kategóriába tartozó lapokról (az alkategóriák és képek kivételével). A lista elemeinek a számát a cikkek számának hívják. Ha nincs egyetlen elem sem a litában, akkor a fejléc nem jelenik meg.
    • Az alkategóriák névtere nem látszik.
  • Képek listája előnézetekkel (nem számolja, hogy hány kép van); megjeleníti a kép nevének első 20 karakterét (a végén három ponttal ha ez nem a teljes név) és a fálj méretét. Az alkategóriák és a cikkek szakaszával ellentétben ebben a szakaszban nincsenek alcímek betűnként

A listák elemei mind linkek az érintett lapokra, képek esetében maga a kép is és alatta a szöveg (a kép neve) is.

Az első két lista elemei kezdőbetűnként külön szakaszban vannak. Ha nem szeretnél külön szakaszokat, akkor használj szóköz kezdetű rendezőkulcsot (lásd lejjebb).

Kategória lapjának létrehozása szerkesztés

Létre tudod hozni egy kategória lapját például

  • ha rákattintasz a kategória automatikus linkjére egy lap alján,

vagy

  • teszel egy kettőspontot a Kategória szó elé a kategóriahivatkozásban, hogy a szoftver ne gondolja, hogy csak be szeretnéd tenni a lapot a kategóriába:
[[:Kategória:Kategória neve]]

Ha beírod ezt a szöveget egy lapra, akkor a lap mentése után a lapon meg fog jelenni egy link a kategóriára, és szerkeszteni tudod majd a lapját.

Rendezés szerkesztés

A rendszer betűrendet, pontosabban Unicode sorrendet használ a lapok és kategóriák rendezésénél. A 32-127 tartomány az ASCIInek felel meg.

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

Megjegyzés: a Z az a előtt van, és a z az ékezetets betűk előtt.

A szóköz a lap nevén belül aláhúzásjelként kezelt, a nagybetűk után és a kisbetűk előtt van. Azonban a szóköz egy név után minden karakter előtt van. Így a sorrend például PC, PCX, PC Bruno, PCjr lenne ezek között az elemek között.

Lásd még: Különleges karakterek, Speciális karakterrel kezdődő lapnevek.

Rendezőkulcs szerkesztés

Mindhárom lista úgy van rendezve, ahogy ezt fent leírtuk. Ha azt szeretnéd, hogy a lista egyik eleme más név szerint (rendezőkulccsal) legyen rendezve, akkor a kategóirahivatkozásban tudod ezt beálíítani:

[[CKategória:Kategória neve|Rendezőkulcs]]

Ha például az Albert Einstein nevű cikket az Emberek kategóriába szeretnéd tenni, és Einstein, Albert-ként rendezni, akkor ezt írd be:

"[[Kategória:Emberek|Einstein, Albert]]".

Annak ellenére, hogy ez a szintaktika úgy néz ki, mint egy más szövegű hivatkozás, és egy szerkesztési összefoglalóban úgy is értelmeződik, van különbség: a második rész egy más szövegű hivatkozásban egy alternatív szöveg az első rész helyett, a rendeési kulcs egy alternatív lapnév annak a lanak, amin ez előfordul. A más szövegű link a lapot magát módosítja, a rendezési kulcs a kategória lapját.

A megjelenített név nem változik, és, sajnos, csak a kategróia tagjainak lapján szerkesztéskor látható. A rendezési kulcs rendszerének leírása hasznos lehet a kategóriák lapján.

A rendezési kulcsos rendszer nyilvánvaló lehet, de egy kategóriában az elemek sorrendje véletlenszerűnek látszhat és nehéz lehet valamit megtalálni.

A szokás szerint a rendezési kulcsot a vezetéknévvel kezdjük, aztán vesszőt és szóközt írunk, aztán a keresztnevet, és mindenegyebet (pl. Ifj.) a végre.

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 (*).

Default sort key szerkesztés

[MW1.10+] It is possible to set a default sort key which is different from {{PAGENAME}} by using the magic word {{DEFAULTSORT}} thus:

{{DEFAULTSORT:new key}}

Once this has been included in an article, the new default sort key will remain in force until the end of the article, or until a fresh {{DEFAULTSORT}} is used.

Sort key of images szerkesztés

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 szerkesztés

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 szerkesztés

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 szerkesztés

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 szerkesztés

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 szerkesztés

To categorize templates themselves, without the pages that call them, one can use the <noinclude> tag, for example

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

Alternatively one can use e.g. {{#ifeq:{{FULLPAGENAME}}|Template:Editthispage|[[Category:category name|{{PAGENAME}}]]|}}

Excluding templates from categories szerkesztés

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" szerkesztés

Backlinks are often used as a by-product of links and inclusions. However, links and inclusion tags can be put specially for the backlinks, just like category tags are.

Thus one can create a kind of "category abc" showing its content with Special:Whatlinkshere/abc without an entry in the category lists on each page in the category. With inclusion this can be done in two ways:

  • {{#if:|{{:abc}}}} rendering nothing. This works regardless of whether abc exists.
  • {{:abc}}. This requires creating a blank page to render nothing, or a page with some content to provide an in-page category listing.

In the case of links:

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.

In the case of inclusions:

  • 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 szerkesztés

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.

Dynamic page list szerkesztés

The DynamicPageList2 extension provides a list of last edits to the pages in a category, or optionally, just the list of pages; the simpler DynamicPageList is installed on Meta and Wikinews; the version DPLforum is installed on Wikia, see http://www.wikia.com/wiki/Help:Forums .

Detection of additions to a category szerkesztés

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 szerkesztés

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 szerkesztés

A colon (":") before the "Category" prefix, e.g., [[:Category:NameOfCategory]], will allow you to include a link to a category page without actually adding the article to that category.

Alternatives for overviews szerkesztés

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 szerkesztés

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 szerkesztés

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).

List of all categories szerkesztés

Special:Categories provides an alphabetic list of all categories, with the number of members of each; this number does not include the content of the subcategories, but it includes the subcategories themselves, i.e., each counting as one. Comparing with http://meta.wikimedia.org/w/index.php?title=Special%3AAllpages&namespace=14 :

  • a category without members is not in the former
  • a category that has not been created as a page is not in the latter (in the former it stands out as red link)

Singular or plural szerkesztés

It is not obvious whether a page like Amsterdam should be in category City (a description of a member of the category) or Cities (a description of the category as a set of pages). A convention for using one or the other is useful (e.g. on w:en), to avoid ending up with both, with part of the applicable pages in one, and part in the other.

Category flattening szerkesztés

Category flattening is displaying also the articles in a category's subcategories, sub-subcategories, etc.

See also m:Category flatten, and [1].

Category intersection and in-page display szerkesztés

Various MediaWiki extensions allow intersection of categories, and more:

They all also allow further restriction to a namespace; some allow also restriction to a union of namespaces, or the complement of a union of namespaces.

They all allow the info to be displayed in any page, not just a separate category page.

See also:

Category union szerkesztés

Various MediaWiki extensions allow union of categories, and more:

See also above.

Display of info about the pages in a category szerkesztés

Various MediaWiki extensions allow display of info about the pages in a category, and more:

See also above.

In-page display of categories a page is in szerkesztés