Template:NameSort
Usage
Usage is super easy. Just type {{NameSort}} at the bottom of a page (before the categories). Then, when you add categories to the page you no longer have to define the sort key for every individual category. It will automatically sort the person by their last name.
Note that this will sort up to the 6th letter of a person's last name, but will sort by the entire last name if the name is 6 letters or shorter. For names that are 7 letters or longer, sorting will continue after having established the first six letters, which still results in proper alphabetisation.
For instance, take the last names, "Smith-Jones" and "Smith-Klein". The template will result in the same sort key for both, Smith-. However, it will still put Smith-Jones ahead of Smith-Klein in the category list, because the MediaWiki software will continue looking for further letters if it finds that two entries have exactly the same sort keys.
Even so, it's fairly unlikely that there will be too many instances of exact sort key matches, since the sort key is 6 letters long.
Demonstration
It's impossible to show the results of this template directly, as it acts in the background of page management.
However, here are some of the ways this template will sort personal names:
Russell T Davies --> Davies, Russell William Ash --> Ash, William Juanita Maria Perez Garcia --> Garcia, Juanita John Ainsworth --> Ainswo, John Cassandra (actress) --> Cassandra Nelvana --> Nelvan John Wood (illustrator) --> Wood, John Arthur Smith -- > Smith, Arthur Hannah Smith --> Smith, Hannah Adam Smith (director) --> Smith, Adam director Adam Smith (disambiguation) --> Smith, Adam disambiguation Adam Smith (writer) --> Smith, Adam writer
Problems
Multi-word last names
One kind of name that won't be handled properly by this template are people who have un-hyphenated but double-barrelled names, like Roger Lloyd Pack. Roger Lloyd Pack would sort under Pack, Roger
, when it should be sorting under Lloyd Pack, Roger
. Obviously, nothing can be done if the person is a character, and the printed work repeatedly fails to use a hyphen. But in the case of actors and other real world people, common sense should prevail. If the person is usually credited with a hyphen, but wasn't in Doctor Who, treat the the end credits as erroneous, and change the name of the page to include the hyphen.
For the time being, people with multi-word last names will have to have a manual edit of their DEFAULTSORT.
Van, von, de, du
Note that names with non-English possessive adjectives are properly sorted in English by the last name. So the template does the right thing by sorting Vincent van Gogh as Gogh, Vincent van
.
However, where the vowel has been eliminated in favour of an apostrophe, the name will be sorted under d'
, D'
or O'
.
Sorting of people with same last names
Because the template was altered on 2 February 2012 to directly include first names, people of the same last names will always be sorted first by their last names, then by their first.
Disambiguated articles
As of 2 February 2012, {{NameSort}} disregards disambiguation terms, and sorts only on the name. So Barnaby Edwards (actor) will be sorted under Edwards, Barnaby actor
. Because the key includes the disambiguation term (minus the parentheses), it's possible to have an alphabetical order even amongst things with the same name.
However, the template does not truncate articles. Notice therefore, what happens to the following:
- John (Remembrance of the Daleks) --> John Remembrance of the Daleks
- John (The Custodians) --> John The Custodians
- John (The Sensorites) --> John The Sensorites
However, this break with standard alphabetisation rules is slight and will likely not be corrected. While there are a number of people who have the same names, these people are only very rarely in the same category. Thus this "error" will hardly ever show.
Best practices
Note that even if a person currently exists in a single category, and that category has a sort key defined for it, you should still use this template. The use of DEFAULTSORT should be universal on all pages about people and characters with at least two names. It should be possible for a person to add a category to a page — without having to edit it — and for that page to be automatically sorted properly.
In other words, the default condition of every "person page" should be that it sorts automatically by last name. This template ensures that goal is achieved.
Authorship
Even if there are other templates out there on wikis that do this same thing, this template's original form was developed entirely here at Tardis.
Widespread implementation
This template was first mass-added to pages by bot on April 11, 2011. It's also being added to preloadable formats so that it will be automatically placed on new pages, so long as editors use those preloadable formats to create pages. Otherwise, if you create a new page about a person without the preloadable format after about 15 April 2011, you'll have to remember to go back and place this template manually.
It was later stripped from the wiki on the first week of February 2012, along with instances of DEFAULTSORT, and then reapplied, so that each article had only one instance of the template. This will greatly reduce the number of pages with errors, since having multiple instances of DEFAULTSORT results in an error (though visual display of errors is deactivated on this wiki).
Another reason for the reapplication was to ensure that the improvements to the template were immediately reflected across the wiki.
Things to do
There are a few other possible improvements which are being considered for this template, as of February 2012.
- Names with von, van, Von, Van, de, and De might eventually be alphabetised under the preposition, rather than the object of that preposition. More study is required to see what impact this will have on our particular collection of names.
- Names with of and the as penultimate word, as in Veronica of Reykjavík or Hereward the Wake, will eventually sort under the PAGENAME (so under Veronica or Hereward).