Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Help:Category

Page semi-protected
From Wikipedia, the free encyclopedia
Information page on Wikipedia categories

For guidelines on the use of categories on Wikipedia, seeWikipedia:Categorization. For a basic readers' guide, seeHelp:Categories. For quick answers, see thereaders' FAQ or theeditors' FAQ on categories. For a list of categories, seeSpecial:Categories.
This page describes editing with the source editor. SeeHelp:VisualEditor § Editing categories forVisualEditor.
Wikipedia information page
This is aninformation page.
It is not anencyclopedic article, nor one ofWikipedia's policies or guidelines; rather, its purpose is to explain certain aspects of Wikipedia's norms, customs, technicalities, or practices. It may reflect differing levels ofconsensus andvetting.
Namespaces
Subject namespacesTalk namespaces
0(Main/Article)Talk1
2UserUser talk3
4WikipediaWikipedia talk5
6FileFile talk7
8MediaWikiMediaWiki talk9
10TemplateTemplate talk11
12HelpHelp talk13
14CategoryCategory talk15
100PortalPortal talk101
118DraftDraft talk119
126MOSMOS talk127
710TimedTextTimedText talk711
828ModuleModule talk829
1728EventEvent talk1729
Former namespaces
108BookBook talk109
442CourseCourse talk443
444InstitutionInstitution talk445
446Education ProgramEducation Program talk447
2300GadgetGadget talk2301
2302Gadget definitionGadget definition talk2303
2600Topic2601
Virtual namespaces
-1Special
-2Media
Current list

Categories are intended to group together pages on similar subjects. They are implemented by aMediaWiki feature that adds any page with a text like[[Category:XYZ]] in its wiki markup to the automated listing that is the category with nameXYZ. Categories help readers to find, and navigate around, a subject area, to see pages sorted by title, and to thus find article relationships.

Categories are normally found at the bottom of an article page. Clicking a category name brings up a category page listing the articles (or other pages) that have been added to that particular category. There may also be a section listing thesubcategories of that category. The subcategorization feature makes it possible to organize categories into tree-like structures to aid navigation.

The termcategory does refer to both the title of a category page—thecategory pagename—and the category itself. Keeping this in mind while reading about categorization, plus learning a category page layout is a worthwhile investment in research techniques. (See also the search box parameter "incategory".) The layout of a category page is mostly text, but see aboutdisplaying category trees below.

Summary

The MediaWiki software maintains tables ofcategories, to which any editable page can be added. To add a page to a category, include "[[Category:Category name]]" or "[[Category:Category name|Sortkey]]" in that page'swiki markup. The categories to which a page belongs appear in a box at the bottom of the page.

A category is usually associated with acategory page in the "Category:"namespace.[1] A category page contains text that can be edited, like any other page, but when the page is displayed, the last part of what is displayed is an automatically generated list of all pages in that category, in the form of links. Other category pages which appear in this list are treated separately, assubcategories.

The bottom of a Wikipedia article onChicken eyeglasses. At the very bottom of the page, below the References, navigation templates and external links are a series of links. These links are the categories used on the page, which include:Category:Animal welfare,Category:Animal equipment,Category:Eyewear, andCategory:Poultry farming. By clicking on the category link at the bottom of the page, readers can navigate the Category tree.

Category page definition

Acategory page is any page in the Category namespace. They each act as a category, and are termed a "category". The category page has one section titledSubcategories listing other "categories", and one section titledPages, listing pages as categorized (inother namespaces). New categories are created bycreating a page in the Category namespace.

A category page can be edited like any other page. However, when it is displayed, the editable part of the page is followed by automatically generated lists of pages belonging to the category, as follows:

  • First a count and list of subcategories (other categories belonging to the category) is shown, if any exist. The name of each subcategory is followed by counts like "(6 C, 38 P, 2 F)", meaning this subcategory contains 6 subcategories, 38 pages, and 2 files. Counts of 0 are omitted. The further subcategories are expanded in the display if the sign alongside the subcategory is clicked (the is only visible if your browser hasJavaScript enabled). Note: is shown if there are no further subcategories. The subcategory is collapsed again if is clicked.
  • Next a count and list of pages in the category (excluding subcategories and images) is shown. If the category has no members, a message to that effect is displayed.
  • Next a count and list of image and other media files in the category appears, if any exist. These are shown with thumbnails. The first 20 characters of the file name are shown, with an ellipsis if that is not the full name; also the file size is shown.

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

For the way in which the lists are ordered, seeSorting category pages below. The first and second lists are divided into sections, according to the first character of the sort key. These initial characters are displayed above the sections. To suppress these, make all sort keys start with a space.

A category page can only display a limited number of members (currently 200). If there are more members, there will be a link to the next page.

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

Putting pages into categories

Shortcut
See also:Help:VisualEditor § Editing categories

A page becomes part of a category if the page's wiki markup contains a declaration for that category. A category declaration takes the form[[Category:Category name]] or[[Category:Category name|Sortkey]]. The declaration must be processed, i.e. it will not work if it appears between<nowiki>...</nowiki> or<includeonly>...</includeonly> tags, or in a comment. The declaration may however come from atranscluded page; seeCategories and templates below.

A category name can be any string that would be a legitimatepage title. If the category name begins with a lower-case letter, it will be capitalized. For initial lower-case letters, as inCategory:macOS, see thetechnical restrictions page.

On Wikipedia, it is customary to place category declarations at the end of the wiki markup, but before anystub templates (which themselves transclude categories).

When a page has been added to one or more categories, a categories box appears at the bottom of the page (or possibly elsewhere, if a non-defaultskin is being used). This box contains a list of the categories the page belongs to, in the order in which the category declarations appear in the processed wiki markup. The category names arelinked to the corresponding category pages. They appear asred links if the corresponding category page does not exist. If a user has enabled theHotCat gadget, the categories box will also provide links to quickly add, remove, or modify category declarations on the page, without having to edit the whole page.

Hidden categories are not displayed, except as described below underHiding categories.

Working with category pages

The following subsections are ordered from simple actions to more elaborate or rarer actions.

Linking to category pages

To link to a category pagewithout putting the current page in that category, precede the link with a colon: [[:Category:Category name]]. Such a link can bepiped like a normal wikilink. (The{{cl}} template, and others listed on its documentation page, may sometimes be helpful.)

Retrieving raw category information

Raw information about the members of a category, their sort keys and timestamps (time when last added to the category) can be obtained from theAPI, using a query of the form:

https://en.wikipedia.org/w/api.php?cmtitle=Category:Category_name&action=query&list=categorymembers&cmlimit=500&cmprop=title|sortkey|timestamp

Listings of up to 500 members are possible. If there are more members then the results will include text near the end like this:<categorymemberscmcontinue="page|NNNN|TITLE"/>.

This can be added to the previous one, without quotation marks, for the next page of members:...&cmcontinue=page|NNNN|TITLE

Sorting category pages

Shortcut

By default, a page is sorted under the first character of its name, without the namespace. English Wikipedia groups accented characters together with their unaccented version, so pages starting with À, Á, Ä, will be listed under heading A. Sorting is case-insensitive, so "ABC" comes after "Abacus".

Unlike atSpecial:Allpages andSpecial:Prefixindex, a space is treated as a space (coming before all other characters), not as an underscore.

The English Wikipedia hasnumerical sorting in categories. This means that digit sequences in page names are treated according to their numerical value, not as strings. Thus "9 dogs", "25 dogs", and "112 dogs" will all appear under the "0–9" heading in numerical order, andV838 Monocerotis will appear beforeV1309 Scorpii.

Each of the three lists (subcategories, pages, media files) is arranged in the order explained above (except that, in the subcategories list, the namespace indicator "Category:" is not considered). If an item ought to be positioned within a list on the basis of 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|Sortkey]]

For example, to add an article calledAlbert Einstein toCategory:1879 births and have the article sorted by "Einstein, Albert", you would type:

[[Category:1879 births|Einstein, Albert]]

Unlike apiped link (which uses the same syntax), the sort key itself is not displayed to readers. It affects only the order in which pages are listed on the category page.

It is useful to document the system being used for sort keys on the category page. For guidelines about the use of sort keys on Wikipedia, seeWP:SORTKEY.

Default sort key

Shortcut
This section documents functionality. For guidelines, seeWP:NAMESORT andWP:SORTKEY.

It is possible to set a default sort key which is different from{{PAGENAME}} by using themagic word{{DEFAULTSORT:}}:

{{DEFAULTSORT:new key}}

This is often used in biography articles, to make sure the subject is sorted by their last name:

{{DEFAULTSORT:LastName, FirstName}}

For example, on theAlbert Einstein page,{{DEFAULTSORT:Einstein, Albert}} adds the sort key "Einstein, Albert" to all his categories, such asCategory:1879 births.

In the case of multiple default sort key tags, the last DEFAULTSORT on the final rendering of a page applies for all categories, regardless of the position of the category tags. This also means that a DEFAULTSORT tag included from a template is not effective if another DEFAULTSORT tag occurs later on the page, even if the later DEFAULTSORT tag is also "hidden" (included by another template). Any conflicts are tracked viaCategory:Pages with DEFAULTSORT conflicts.

Searching for pages in categories

Further information:Help:Searching § Syntax
See also:§ Searching for articles in categories, andWikipedia:Category intersection

In addition to browsing through hierarchies of categories, it is possible to use the search tool to find specific articles in specific categories. To search for articles in a specific category, typeincategory:"CategoryName" in the search box.

A pipe "|" can be added to join the contents of one category with the contents of another. For example, enter

incategory:"Suspension bridges|Bridges in New York City"

to return all pages that belong to either (or both) of the categories, ashere.

Note that using search to find categories will not find articles which have been categorized using templates. This feature also doesn't return pages in subcategories.

Listing all categories

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.

The above list contains all categories that have members, regardless of whether they have corresponding category pages. To list all existing category pages (regardless of whether they have members), useSpecial:AllPages/Category:.

Displaying category trees and page counts

As described atmw:Help:Magic words,{{PAGESINCATEGORY:Example}} or{{PAGESINCAT:Example}} returns the number of pages in "Category:Example". Each subcategory counts as one page; pages in subcategories are not counted.

The pageSpecial:CategoryTree enables you to see the tree structure of a category (its subcategories, their subcategories and so on; the display of files and other member pages is optional).

TheCategoryTree extension can be used to display such a tree on any page. (This is sometimes done on the category page itself, if the category is split over multiple screens, to make all subcategories available on every screen.) The basic syntax is

  • <categorytree>Category name</categorytree>

to display just the subcategory tree, and

  • <categorytree mode=pages>Category name</categorytree>

to display member pages as well. They will be indicated by italics.

Dapete's category-visualizervCat will render charts of the tree structure.

You may also useTemplate:Category tree orTemplate:Category tree all, instead.

Warning:

The following code{{PAGESINCATEGORY:{{PAGENAME}}}} will not work as expected when used in the wikitext or in a transcluded template in a category page whose title contains some ASCII punctuations.
For legacy reasons,{{PAGENAME}} may return the page name with these characters being HTML-encoded using numeric character entities : this still works for generating derived wikilinks or displaying page names, or when HTML-encoded this page name is used in a conditional "#switch", but PAGESINCATEGORY does not recognize the category name given in parameter if some characters are HTML-encoded (this is the case notably when the category name contains ASCII apostrophes' and a few other ASCII punctuations. (The same HTML-encoding is also applied to the values returned by{{FULLPAGENAME}},{{SUBPAGENAME}}, or{{NAMESPACE}}).
In that case, as the category is not found by its HTML-encoded pagename, PAGESINCATEGORY will unexpectedly return 0 and not its effective number of member pages.
A simple workaround is to transform these HTML-encoded characters back into standard UTF-8-encoded characters, by using the{{titleparts:}} parser function, like this:
{{PAGESINCATEGORY:{{titleparts:{{PAGENAME}}}}}}

Moving and redirecting category pages

Categories can be moved in the same way as an ordinary page; but a certain amount of cleanup may be necessary. A redirect is left at the old category name, and this is not a normal#REDIRECT [[...]] but a{{category redirect}}. Once all the pages have been moved out of the old category, it may be left as a category redirect or deleted. For categories entirely populated through templates (see above), modifying the templates enables all affected articles to be moved to another category, but with the refresh problem mentioned. Almost all category name changes are made pursuant to a consensus decision atWikipedia:Categories for discussion.

Do not create intercategory redirects other than with a{{category redirect}} template. SeeWikipedia:Categories for discussion § Redirecting categories for more on category redirects.

Hiding categories

When themagic word__HIDDENCAT__ is placed on a category page, that category becomeshidden, meaning that it will not be displayed on the pages belonging to that category. On Wikipedia, the magic word is not normally used explicitly, but is applied through the{{hidden category}} template. The feature is mostly used to prevent project maintenance categories from showing up to ordinary readers on article pages.

For users who are notlogged in, hidden categories are displayed on category pages (whether as parent categories or subcategories).

Hidden categoriesare displayed at the bottom of each page, after "Hidden categories:", for registered users:

  • at preview during editing;
  • if the user has selected "Show hidden categories" in their user preferences.

Hidden categories are automatically added toCategory:Hidden categories.

For guidelines on the hiding of categories on Wikipedia, seeWP:HIDDENCAT.

Tracking categories

Tracking categories are used to track technical featues or problems. They are outside of the category structure for articles. Pages may be inserted into those by the MediaWiki software, or by templates or modules. Usually they are hidden, or even red ie not created.Special:TrackingCategories lists all tracking categories populated by the MediaWiki software.Category:Tracking categories is the top for tracking categories on this wiki.

Finding articles for a category

The most effective way of finding entries of a category is using the "What links here" tool on the category's main article.

An easy way to find relevant articles for a new category or missing entries in an existing one is by finding the most relevantlist and checking its entries. Sometimes categories are about things that areintersections of other categories for which thePetScan tool can be used.

More relevant articles may also be found linked in a category's main article and the articles already featured in the category − especially in their"See also" sections (if existent) and the automatically suggested "RELATED ARTICLES" below them.

Furthermore, a category's superordinate categories often feature articles that should be subcategorized to the category.

Other ways to find relevant articles includesearching Wikipedia for the category's topic and searching the Web for the topic in quotes" (with synonyms also in quotes and appended after anOR) and appending the wordwiki orWikipedia orsite:Wikipedia.org to them.

Categorizing

Main page:Wikipedia:Categorization

Categorizing templates

Templates are categorized the same way as articles, except that[[Category: Some-topic templates]] should be placed on the template's documentation page (or inside<noinclude>...</noinclude> tags, if there is no documentation page), this is necessary to avoidcategorizing pages by template inclusion (see below).

Categories and templates

A template can be used to add pages to a category, usually by placing the category link inside<includeonly></includeonly> tags on the template (e.g.<includeonly>[[Category:category name]]</includeonly>). When the template is transcluded into the page, the category link becomes active, and the page is added to the category page. This is useful for categories that have high turnover or many pages included, like cleanup categories.

Changes to the template, however, may not be reflected immediately on the category page. When you edit an article to add a category tag directly, the list of category members is updated immediately when the page is saved. When a category link is contained in a template, however, this does not happen immediately: instead, whenever a template is edited, all the pages that transclude it are put into thejob queue to be recached during periods of low server load. This means that, in busy periods, it may take hours or even days before individual pages are recached and they start to appear in the category list. Performing anull edit to a page will allow it to jump the queue and be immediately recached.

To add the template itself to the category page as well, omit the "includeonly" tags. To add the template to a categorywithout categorizing pages on which the template is transcluded, place the category declaration between <noinclude>...</noinclude> tags, or add it to thetemplate documentation page between<includeonly></includeonly> (the latter allows recategorizing the template without editing it, which is helpful if it is protected, or so complicated that mere mortals hesitate to touch it).

Parser functions can be used to make the transcluded categories, or the sort key used in them, dependent on other variables, notably PAGENAME.

Passing a category name as a parameter
<includeonly>[[Category:{{{cat|default}}}]]</includeonly> or <includeonly>{{{cat|[[Category:default]]}}}</includeonly>
If the user provides a parameter 'cat=XXX' the page will be categorized at the page[[Category:XXX]], otherwise it will be categorized at the page[[Category:default]]. Calling the template with "cat=" (equal to nothing) disables putting the page in any category.
Excluding non-article pages
<includeonly>{{#if:{{NAMESPACE}} | | [[Category:XXX]]}}</includeonly>
the variable NAMESPACE is null for mainspace articles. For any space other than mainspace, this ParserFunction will produce an empty string, but for regular articles this will include the article in Category:XXX.

On Wikipedia it is not recommended that templates be used to populate ordinary content categories of articles. SeeCategorization using templates in the categorization guideline.

Categorizing redirect pages

Main page:Wikipedia:Categorizing redirects

Redirect pages can be categorized and there are conventions on how to do it. The redirect link must be first on the page. On a category page, redirects are listed in italics.

"Related Changes" with categories

For a category, the "Related Changes" feature, when applied to the corresponding category page, lists recent changes to the pages which are currently listed as belonging to a category. Where those pages are subcategories or image pages, only changes to theireditable parts are listed.

Notice that "Related Changes" doesnot show edits to pages that have been removed from the category.

Also, "Related Changes" doesnot list recent changes to pages linked from the editable part of the category page (as it would normally, with a non-category page). If a workaround would be required, the links in question could be placed in a template and transcluded onto the category page.

As usual – unlike withwatchlists – recent changes to correspondingtalk pages arenot shown under "Related Changes". Pages that one is watching are bolded on the list. This can help to find which pages in a given category one has on one's watchlist.

TheDynamicPageList (third-party) extension provides a list oflast edits to the pages in a category, or optionally, just the list of pages; the simplerDynamicPageList (Wikimedia) is installed on Meta, Wikinews,Wikibooks andWikiversity; the extensionmw:Extension:DPLforum is installed on Wikia.

Watching category additions and removals

Since2016, additions and removals from categories are available via the"Category changes" filter on recent changes pages, includingwatchlists andSpecial:RecentChangesLinked. For example, category changes to articles inCategory:Cannabis stubs can befound here. You can monitor additions and removals from specific categories by adding the categories to your watchlist and making sure the "Category changes" filter is active. You can view changes to categories in your watchlist byclicking here. Additional scripts with similar functionality areUser:CategoryWatchlistBot andUser:Ais523/catwatch.

See also

Notes

  1. ^The category itself is permanently created as soon as it has been saved on to any page. Unless you create acategory page, it will display as a red link. Unless you add another category to the category page, it will not be placed in the category tree. Category pages are created like any other page. Most commonly, editors click on the redlink in an article and create the category page that way.
About Wikipedia (?)
Help for readers (?)
Contributing
to Wikipedia
 (?)
Getting started (?)
Dos and don'ts (?)
How-to pages and
information pages (?)
Coding (?)
Directories (?)
General
technical help
Special
page
-related
Wikitext
Links anddiffs
Media files: images,
videos and sounds
Other graphics
Templates and
Lua modules
Data structure
HTML andCSS
Customisation
and tools
Automated editing
Wikipedia categorization
Guidelines
Help pages
Discussions
Projectspace essays
Userspace essays
Retrieved from "https://en.wikipedia.org/w/index.php?title=Help:Category&oldid=1299246119"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp