Template:Sortname
Sarna News
- HEXTECH Review - Wave 3 Brings More Urban Options To Your Battlefield
- Your BattleTech News Round-Up For March, 2024
- Crashing 'Mechs With Jennifer Brozek, Author Of The Rogue Academy Trilogy
- Getting The Word Out With Rem Alternis, Catalyst Community & Marketing Director
- Bad 'Mechs - Yeoman
- Read more →
<span data-sort-value="{{{last}}}, {{{first}}}">[[{{{first}}} {{{last}}} ({{{dab}}})|{{{first}}} {{{last}}}]]</span>
This template uses Lua: |
- Usage
{{sortname|first|last|optional link target|optional sort key}}
Creates a wikilinked name that can be used in a sortable table (created with class="wikitable sortable").
- The default sort key is "last, first".
- The link label is "first last".
- The default link target is "first last"
The optional link target is useful when "first last" is a disambiguation page instead of the desired article, or when linking to a section of a page.
The optional sort key is useful in the case of special characters such as é.
- Optional parameters
|dab=disambiguator
- Wikilinks to "first last (disambiguator)".
(Note: ignored if optional link target is not blank.)
- Wikilinks to "first last (disambiguator)".
|nolink=1
- Suppresses wikilinking the name, useful for list entries which are likely to never have articles so shouldn't be redlinked.
(Note: optional link target ignored when "|nolink=1" used.)
- Suppresses wikilinking the name, useful for list entries which are likely to never have articles so shouldn't be redlinked.
Examples[edit]
# | What you type | What's generated |
---|---|---|
1 | {{sortname|first|last}}
|
<span data-sort-value="last, first">[[first last|first last]]</span> |
2 | {{sortname|first|last|nolink=1}}
|
<span data-sort-value="last, first">first last</span> |
3 | {{sortname|first|last|dab=disambiguator}}
|
<span data-sort-value="last, first">[[first last (disambiguator)|first last]]</span> |
4 | {{sortname|first|last|target}}
|
<span data-sort-value="last, first">[[target|first last]]</span> |
5 | {{sortname|first|last||sort}}
|
<span data-sort-value="sort">[[first last|first last]]</span> |
6 | {{sortname|first|last||sort|nolink=1}}
|
<span data-sort-value="sort">first last</span> |
7 | {{sortname|first|last|target|sort}}
|
<span data-sort-value="sort">[[target|first last]]</span> |
# | What you type | What's displayed | What's sorted | What's linked |
---|---|---|---|---|
1 | {{sortname|James|Bixby}}
|
James Bixby | Bixby, James | James Bixby |
2 | {{sortname|James|Bixby|nolink=1}}
|
James Bixby | Bixby, James | (no link) |
3 | {{sortname|James|Bixby|dab=person}}
|
James Bixby | Bixby, James | James Bixby (person) |
4 | {{sortname|James|Bixby|James Bixby (person)}}
|
James Bixby | Bixby, James | James Bixby (person) |
Note[edit]
To link to a section within the page in which the template appears, encode the number sign:
{{Sortname|Examples||#Examples}}
- gives: Examples
See also[edit]
- w:Help:Sorting#Specifying a sort key for a cell
- {{sort}} – general sorting
- {{Date table sorting}} – for using dates in sortable tables
- {{Number table sorting}} – for using alphabetic sort mode for numbers in sortable tables
- {{Last word}}