Template:Sortname: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
(Created page with "<includeonly><span data-sort-value="{{{2|{{{last}}}}}}, {{{1|{{{first}}}}}}">{{#if:{{{nolink|{{#ifeq:{{{1|{{{first|}}}}}}{{{2|{{{last|}}}}}}{{{dab|}}}|-|1}}}}} | <span class=...")
Tag: 2017 source edit
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<includeonly><span data-sort-value="{{{2|{{{last}}}}}}, {{{1|{{{first}}}}}}">{{#if:{{{nolink|{{#ifeq:{{{1|{{{first|}}}}}}{{{2|{{{last|}}}}}}{{{dab|}}}|-|1}}}}}
<includeonly><</includeonly><noinclude>&lt;</noinclude>span data-sort-value="{{{2|{{{last}}}}}}, {{{1|{{{first}}}}}}">{{#if:{{{nolink|{{#ifeq:{{{1|{{{first|}}}}}}{{{2|{{{last|}}}}}}{{{dab|}}}|-|1}}}}}
| <span class="vcard"><span class="fn">{{{1|{{{first}}}}}} {{{2|{{{last}}}}}}</span></span>
| <span class="vcard"><span class="fn">{{{1|{{{first}}}}}} {{{2|{{{last}}}}}}</span></span>
| <span class="vcard"><span class="fn">[[{{#if:{{{3|{{{link|}}}}}}
| <span class="vcard"><span class="fn">[[{{#if:{{{3|{{{link|}}}}}}
Line 6: Line 6:
     }}
     }}
   }}|{{{1|{{{first}}}}}} {{{2|{{{last}}}}}}]]</span></span>
   }}|{{{1|{{{first}}}}}} {{{2|{{{last}}}}}}]]</span></span>
}}</span></includeonly><noinclude>{{documentation}}[[Category:Internal link templates]]</noinclude>
}}<includeonly><</includeonly><noinclude>&lt;</noinclude>/span><noinclude>{{documentation}}[[Category:Internal link templates]]</noinclude>

Latest revision as of 21:02, 15 January 2024

<span data-sort-value="{{{last}}}, {{{first}}}">[[{{{first}}} {{{last}}} ({{{dab}}})|{{{first}}} {{{last}}}]]</span>

Instructions for {{Sortname}}
{{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.