Help:Category: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
m Reverted changes by 178.90.10.234 (talk) to last version by Camouflaged Mirage
No edit summary
Tag: Reverted
Line 1: Line 1:
{{H:h|reader toc}} <!-- do not remove this line -- it calls a template, that can accept arguments-->
{{H:h|reader to<!-- do not remove this line -- it calls a template, that can accept arguments-->
Categories, a software feature of MediaWiki, provide automatic indexes that are useful as tables of contents.
Categories, a software feature of MediaWiki, provide automatic indexes that are useful as tables of contents.



Revision as of 18:29, 2 March 2021

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

If the category contains pages but does not "exist" as editable page, "Related changes" can be applied, but no link is supplied, one has to supply the URL oneself. It is more convenient to "create" the page first.

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.

Dynamic page list

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

By checking "Related changes" from a category page 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.

Comparison with "What links here"

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

Category considerations

Where 2 is a subcategory of 1. In general, this kind of categorization is not approved.

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.

Multi-hierarchy with a single root category

The category structure is (ideally) a multi-hierarchy with a single root category. All categories (except root category 1) should be contained in at least one other category, and there should be no cycles (i.e. a category should not contain itself, directly or indirectly). The category structure should reflect a hierarchy of concepts, from the most generic one down to the very specific.

Check the conventions

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.

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.

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.

Alternatives for overviews

In addition to the automatic lists of pages and images, an overview of links to pages or images (by means of thumbnails) can be put in the editable part of a category, just like in any page. This used to be widely used in Wikimedia Commons, but now most of such overviews are moved to article namespaces. See also commons:Commons:Images on normal pages or categories:Vote.

Extensions

Category intersection, union, etc.

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

  • Semantic MediaWiki
    • Main Page - start page
    • Introduction - allows further intersection with sets of pages defined in terms of relations and attributes
    • Inline queries - provides relation- and attribute-related info about the selected pages and in-page display on any page of categories the same or another page is in
  • DynamicPageList extension can be used to:
    • intersection of categories
    • generate a list of all those articles (or a random sample)
    • show metadata of the articles (popularity, date of last update, ..)
    • show one or more chapters of the articles ('transclude' content)
    • show parameter values which are passed to the common template
    • order articles appropriately
    • present the result in a sortable table (e.g.)
    • use multi column output
  • Forum
    • intersection of categories and complements of categories
    • provides the time of last edit for each page

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 w:Wikipedia:Category intersection.

Category flattening

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

See also m:Category flatten, and Wikimedia bug 1497.

Count

As described at Help:Magic_words#Other_2, {{PAGESINCATEGORY:Example}} or {{PAGESINCAT:Example}} return the number of articles in Category:Example (including the number of subcategories, not the articles in the subcategories).

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