Template:Sortkey/Documentation.
This page has been transcluded fromThis template returns a hidden string that can be used to enforce a specific sort order in sortable tables.
Usage
- First unnamed parameter
The most useful feature of the template is creating chronological sortkeys by using a date. Most date formats will be recognized, such as "January 1, 2011" or "2011-Jan-01". For instance:
{{sortkey|January 1, 2011}}
will return <span style="display:none;">20110101</span>January 1, 2011.
- Second unnamed parameter
You can also use this template to create your own sortkey, not based on time, by using the second unnamed parameter by itself. This can be useful for getting text to sort how you want (such as sorting "The Goonies" by the letter "G"). Note that when using the second unnamed parameter, nothing is returned after the sortkey.
{{sortkey||Goonies, The}}
will return <span style="display:none;">Goonies, The</span>.
- No parameters
If no parameters are used, the template returns an exclamation point, which will sort before most other characters.
{{sortkey}}
will return <span style="display:none;">!</span>.
Example
Code | Result |
---|---|
{{sortkey|Dec-2011}} |
Dec-2011 |
{{sortkey|October 3, 2005}} |
October 3, 2005 |
{{sortkey}}The beginning of time |
The beginning of time |
{{sortkey|5-3-2008}} |
5-3-2008 |
{{sortkey|03-Jan-2007}} |
03-Jan-2007 |
{{sortkey||20110222}}My birthday |
My birthday |