Difference between revisions of "Template:DEFAULTSORT/doc"
imported>John Cline (Modify header; move instruction into section content—It is not a function of the header to itself be an instruction) |
imported>John Cline (ce, We're not setting a default sort key we're modifying it away from the default) |
||
| Line 9: | Line 9: | ||
==Understanding DEFAULTSORT== | ==Understanding DEFAULTSORT== | ||
| − | It is possible to set a | + | It is possible to set a sort key which is different from the default sort key: <tt><nowiki>{{PAGENAME}}, </nowiki></tt> by using the <tt><nowiki>{{DEFAULTSORT}}</nowiki></tt> [[Help:magic words|magic word]]; for example:<br /><tt><nowiki>{{DEFAULTSORT:new key}}</nowiki></tt><br />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). |
| − | <tt><nowiki>{{DEFAULTSORT:new key}}</nowiki></tt> | + | *Becoming familiar with the following link is a good primmer for understanding DEFAULTSORT: |
| − | + | **[[Help:Category#Default sort 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). | ||
| − | |||
| − | Becoming familiar with the following link is a good primmer for understanding DEFAULTSORT: | ||
| − | *[[Help:Category#Default sort key]] | ||
==Template placement== | ==Template placement== | ||
Revision as of 10:51, 15 May 2014
| This is a documentation subpage for Template:DEFAULTSORT. It contains usage information, categories and other content that is not part of the original template page. |
| 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. |
{{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 a specific page 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).
Understanding DEFAULTSORT
It is possible to set a sort key which is different from the default sort key: {{PAGENAME}}, by using the {{DEFAULTSORT}} magic word; for example:
{{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).
- Becoming familiar with the following link is a good primmer for understanding DEFAULTSORT:
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
- {{DISPLAYTITLE}}