Template:Sortkey/Documentation: Difference between revisions

Template page
w:c:strategywiki>Prod
m (noinclude)
m (3 revisions imported: Imported from https://strategywiki.org/)
 
(No difference)

Latest revision as of 18:27, 28 October 2023

This template returns a hidden string that can be used to enforce a specific sort order in sortable tables.

Usage[edit source]

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[edit source]

Code Result
{{sortkey|Dec-2011}} 20111201Dec-2011
{{sortkey|October 3, 2005}} 20051003October 3, 2005
{{sortkey}}The beginning of time !The beginning of time
{{sortkey|5-3-2008}} 200803055-3-2008
{{sortkey|03-Jan-2007}} 2007010303-Jan-2007
{{sortkey||20110222}}My birthday 20110222My birthday