Template:Sortname/doc: Difference between revisions
From Tardis Wiki, the free Doctor Who reference
NateBumber (talk | contribs) (Created page with "'''{{tl|sortname}}''' is a shortcut that equates the following markup: <pre><span data-sort-value="variable2, variable1">variable1 variable2</span></pre> It's useful for...") Tag: 2017 source edit |
Bongolium500 (talk | contribs) (→Usage) |
||
(One intermediate revision by one other user not shown) | |||
Line 4: | Line 4: | ||
== Usage == | == Usage == | ||
{{tl|sortname}} is useful for | {{tl|sortname}} is useful for sortable tables, so that authors can be sorted alphabetically by last name rather than first. Hence, | ||
:<code><nowiki>{{sortname|Steven|Moffat}}</nowiki></code> results in <span data-sort-value="Moffat, Steven">[[Steven Moffat]]</span>. | :<code><nowiki>{{sortname|Steven|Moffat}}</nowiki></code> results in <span data-sort-value="Moffat, Steven">[[Steven Moffat]]</span>. | ||
If the author's page title includes a dab term, as in [[Dave Stone (writer)]], you can add it manually using <nowiki>dab</nowiki>. For instance, | If the author's page title includes a dab term, as in [[Dave Stone (writer)]], you can add it manually using <nowiki>dab</nowiki>. For instance, | ||
:<code><nowiki>{{sortname| | :<code><nowiki>{{sortname|Andrew|Smith|dab=writer}}</nowiki></code> renders <span data-sort-value="Smith, Andrew">[[Andrew Smith (writer)|Andrew Smith]]</span>. | ||
Alternately, you can override the link entirely: | Alternately, you can override the link entirely: | ||
:<code><nowiki>{{sortname|Terence Joseph|Nation|Terry Nation}}</nowiki></code> yields <span data-sort-value="Nation, Terence Joseph">[[Terry Nation|Terence Joseph Nation]]</span>. | :<code><nowiki>{{sortname|Terence Joseph|Nation|Terry Nation}}</nowiki></code> yields <span data-sort-value="Nation, Terence Joseph">[[Terry Nation|Terence Joseph Nation]]</span>. |
Latest revision as of 18:48, 6 September 2023
{{sortname}} is a shortcut that equates the following markup:
<span data-sort-value="variable2, variable1">[[variable1 variable2]]</span>
It's useful for sortable tables and based on a Wikipedia template.
Usage[[edit source]]
{{sortname}} is useful for sortable tables, so that authors can be sorted alphabetically by last name rather than first. Hence,
{{sortname|Steven|Moffat}}
results in Steven Moffat.
If the author's page title includes a dab term, as in Dave Stone (writer), you can add it manually using dab. For instance,
{{sortname|Andrew|Smith|dab=writer}}
renders Andrew Smith.
Alternately, you can override the link entirely:
{{sortname|Terence Joseph|Nation|Terry Nation}}
yields Terence Joseph Nation.
Or you can their name to be sorted properly but without linking to their article:
{{sortname|Steven|Moffat|nolink=1}}
results in Steven Moffat.