Template:DEFAULTSORT/doc

From blackwiki
< Template:DEFAULTSORT
Revision as of 09:25, 15 May 2014 by imported>John Cline (Add preview of standard placement example.)
Jump to navigation Jump to search

{{DEFAULTSORT:<sort key>}} is a magic word used to apply a sort key to many categories at once. It can be overridden for individual categories applied to an article by manually applying a sort key.

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

To understand DEFAULTSORT read the following

It is possible to set a default sort key which is different from {{PAGENAME}} by using the magic word {{DEFAULTSORT}} thus:
{{DEFAULTSORT:new key}}
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).

Template placement

When using {{DEFAULTSORT}}, (to modify the default sort key), the template should be placed at the left margin of a new line, immediately above the line which begins the list of categories. A typical example would look like:

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

{{Templates}}

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

See also