• Home
  • Random
  • Recent changes
  • Special pages
  • Community portal
  • Preferences
  • About WIKIYRI
  • Disclaimers
WIKIYRI
  • Talk
  • Contributions
  • Create account
  • Log in

Template:DEFAULTSORT

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here


Template documentation[view] [edit] [history] [purge]
CautionPlease use {{DEFAULTSORT:Sortkey}}, rather than {{DEFAULTSORT|Sortkey}}. This uses the magic word directly instead of using the template to call the magic word.

{{DEFAULTSORT:<sort key>}} is a magic word used to modify the sequence of pages shown on category pages. The given sort key in a specific page is used to determine that page's position in all category pages where the page is listed. Note: The specific page will still be listed with its original title, regardless of the modified sort order. The sort key can be overridden for specific categories, if their [[Category:]] tags contain a differing individual sort key.

It is not necessary to use DEFAULTSORT at all if the article or page should be alphabetized according to its title (which is true for most articles).

For background information on how the pages in a category are ordered, see Wikipedia:Categorization § Sort keys and Help:Category § Default sort key.

Contents

  • 1 Understanding DEFAULTSORT
  • 2 Placement
  • 3 Tracking category
  • 4 See also
  • 5 TemplateData

Understanding DEFAULTSORTEdit

By default, pages listed on a category page are sorted by {{PAGENAME}}. It is possible to set a different sort key by using the {{DEFAULTSORT}} magic word.

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

PlacementEdit

When using {{DEFAULTSORT}} to modify the default sort key, the magic word should be placed at the left margin of a new line, immediately above the line which begins the list of categories. For example, the last lines of a typical article titled Forename Surname could look like:

==Final section==
Final line of content in "final section".

{{Templates}}

{{Last metadata template
| LAST PARAMETER OF LAST METADATA TEMPLATE = Parameter content
}}
{{DEFAULTSORT:Surname, Forename}}
[[Category:Forename Surname| ]]

Tracking categoryEdit

  • Category:Pages which use a template in place of a magic word (0)

See alsoEdit

  • {{DISPLAYTITLE}}

TemplateDataEdit

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.

TemplateData for DEFAULTSORT

{{DEFAULTSORT:<sort key>}} is a magic word used to modify the sequence of pages shown on category pages. Please use {{DEFAULTSORT:Sortkey}} rather than {{DEFAULTSORT|Sortkey}}, with a colon (":"), not a pipe symbol ("|"). This uses the magic word directly instead of using the template to call the magic word.

Template parameters

ParameterDescriptionTypeStatus
11

no description

Unknownoptional
This template may have no transclusions, because the magic word should always be used instead.
The above documentation is transcluded from Template:DEFAULTSORT/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.


Retrieved from "https://en.wikiyri.org/w/index.php?title=Template:DEFAULTSORT&oldid=1403"
Last edited on 2 July 2022, at 17:49
Cookies help us deliver our services. By using our services, you agree to our use of cookies.
More information
WIKIYRI
  • This page was last edited on 2 July 2022, at 17:49.
  • Content is available under CC0 Public Domain unless otherwise noted.
  • Privacy policy
  • About WIKIYRI
  • Disclaimers
  • Terms of Use
  • Donate to Miraheze
  • Mobile view