Export this template, then import, to install it.
Use edit summary: Copied from [[w:c:templates:Template:Sortkey]] to properly attribute this template's editors.
This template is probably not already on your wiki.
Template documentation
Note: the template above may sometimes be partially or fully invisible.

View or edit this documentation. (How does this work?)

Editors can experiment with this template's sandbox and test case pages.
This template is for sorting tables by placing invisible sortkeys to sort tables if sorting them gives wrong results.
Type {{Sortkey|your number}} or {{Sortkey|your number|number of digits}} in the table cell.
Sample output
{{Sortkey|25000}} gives an invisible number 00000000000000025000. The number gets zero padded to match 20 digits. if this isn't enough, a second parameter can be used as number of digits.
{{Sortkey|40|3}} gives an invisible number 040. If the sortkey is decimal the sorting might not sort well when it's getting sorted in text. Solutions are: to be consistent with number of decimals (every sortkey the same number of decimals) or adding a seconds sortkey for the decimal part.
{{Sortkey|anything|0}} can be used to have anything invisible without zero padding.
Community content is available under CC-BY-SA unless otherwise noted.