MyWikiBiz, Author Your Legacy — Thursday September 11, 2025
Jump to navigationJump to search
1,937 bytes added
, 06:05, 16 July 2021
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use}}
{{Lua|Module:Arguments|Module:String}}
'''Module:Sort title''' is used to create [[WP:SORTKEY|sortkeys]] for pages.
== What it does ==
The module preforms the following checks:
* If the first word of the title is an [[Article (grammar)|article]], it moves it to the end of the title. For example: <code>The Avengers</code> will have a sortkey of <code>Avengers, The</code>.
* If the title is disambiguated and the first word of the disambiguation is an [[Article (grammar)|article]], it moves it to the end of the disambiguation. For example: <code>Pilot (The Flash)</code> will have a sortkey of <code>Pilot (Flash, The)</code>.
* If the title is disambiguated and the first word of the title and the disambiguation is an [[Article (grammar)|article]], both of the above changes will occur. For example: <code>The End (A Series of Unfortunate Events)</code> will have a sortkey of <code>End, The (Series of Unfortunate Events, A)</code>.
* If the title is a number which is separated by a commas, it removes the commas. For example: <code>4,722 Hours</code> will have a sortkey of <code>4722 Hours</code>.
== Usage ==
From template:
* {{Mlx|{{BASEPAGENAME}}|getSortKey}}
* {{Mlx|{{BASEPAGENAME}}|getDefaultSort}}
From module:
<syntaxhighlight lang="lua">local sortkeyModule = require('Module:Sort title')
local sortkey = sortkeyModule._getSortKey()
</source >
== Function list ==
{| class="wikitable"
|-
! scope="col" | Function
! scope="col" | Explanation
|-
! scope="row" | <code>getSortKey</code>
| Returns a sortkey
|-
! scope="row" | <code>getDefaultSort</code>
| Returns a [[WP:DEFAULTSORT|DEFAULTSORT]] string
|}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Wikipedia modules]]
}}</includeonly>