Template:Sort

From Australian sf information
Jump to navigation Jump to search

[[{{{1}}}]]

{{#if:|{{{{{1}}}}}|This template is for optionally sorting tables by specified sortkeys.

If necessary, one can apply sorting using a sortkey that due to CSS is not displayed: <span style="display:none">...</span>. Javascript sorting is based on the text inside and outside the tags, without the tags themselves. A hidden sortkey can be put at the start.

This template makes that more convenient. The first parameter is the sortkey; the second parameter is the wikitext of what has to be displayed. By default, this is the sortkey with link brackets.

To use it, place this in your table cell
|{{sort|Brothers Karamazov|[[The Brothers Karamazov]]}}

It presently works through hidden CSS, as described at Help:Sorting. If a cleaner way of doing this is developed, the template will be changed. A table using this template should use it in all rows.

See also

  • {{#if: | [[:Sortname:Template:{{{2}}}]] ([[:Sortname:Special:Whatlinkshere/Template:{{{2}}}|backlinks]], [{{fullurl:Sortname:Template:{{{2}}}|action=edit}} edit]) | Template:Sortname (backlinks, edit) }} — for using names in sortable tables
  • {{#if: | [[:dts:Template:{{{2}}}]] ([[:dts:Special:Whatlinkshere/Template:{{{2}}}|backlinks]], [{{fullurl:dts:Template:{{{2}}}|action=edit}} edit]) | Template:dts (backlinks, edit) }} — for using dates in sortable tables
  • {{#if: | [[:nts:Template:{{{2}}}]] ([[:nts:Special:Whatlinkshere/Template:{{{2}}}|backlinks]], [{{fullurl:nts:Template:{{{2}}}|action=edit}} edit]) | Template:nts (backlinks, edit) }} — for using alphabetic sort mode for numbers in sortable tables
  • {{#if: | [[:hs:Template:{{{2}}}]] ([[:hs:Special:Whatlinkshere/Template:{{{2}}}|backlinks]], [{{fullurl:hs:Template:{{{2}}}|action=edit}} edit]) | Template:hs (backlinks, edit) }} — for providing a hidden sort value for cells in a table }}