Extension:SubpageSortkey
Subpage Sortkey Release status: stable |
|
---|---|
Description | change the default sortkey to have something to do with the subpages |
Author(s) | Brian Wolff (bawolfftalk) |
Latest version | 0.2.0 |
MediaWiki | 1.18 |
License | GNU General Public License 2.0 or later |
Download | |
|
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Translate the SubpageSortkey extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
What can this extension do?
This extension changes the default sortkey from the full page name, to something involving the subpage structure of the page name. For example it can be configured to make Foo/bar/baz sort under bar/baz or baz/Foo or baz, etc.
Usage
This has a config option ($wgSubpageSortkeyDefault
) which contains a bunch of comma separated numbers and ranges to determine what parts of the page title will be used for the default sortkey. 0
represents the base page name, 1
represents the first subpage, etc. Negative numbers count backwards; -1
is the last subpage-part of the title. ranges are denoted with ..
- aka 2..4
is the same as 2,3,4
. The second number in the range is optional, and negative ranges are slightly weird (second number is not inclusive). This is easiest explained in examples:
$wgSubpageSortkeyDefault = '1,0,2';
will sort the page 0/1/2/3/4 under 1/0/2$wgSubpageSortkeyDefault = '2,0..3';
will sort the page 0/1/2/3/4 under 2/0/1/2/3$wgSubpageSortkeyDefault = '-1,0';
will sort the page 0/1/2/3/4 under 4/0$wgSubpageSortkeyDefault = '1..';
will sort the page 0/1/2/3/4 under 1/2/3/4$wgSubpageSortkeyDefault = '-4..-1';
will sort the page 0/1/2/3/4 under 1/2/3 (not under 1/2/3/4)$wgSubpageSortkeyDefault = '-4..';
will sort the page 0/1/2/3/4 under 1/2/3/4
You can also customize the default sortkey per namespace with $wgSubpageSortkeyByNamespace
. Example: $wgSubpageSortkeyByNamespace[NS_TALK] = '-1'
;
$wgSubpageSortkeyIfNoSubpageUseFullName
can be used to control what happens if the subpage sorting comes up with an empty string (aka $wgSubpageSortkeyByNamespace = '2';
on a page with no subpages) Setting it to true
(default) means it will use the page's title as the sortkey. Setting to false
means it will use the empty string.
Other details
$wgSubpageSortkeyIfNoSubpageUseFullName
can be used to control what happens if the subpage sorting comes up with an empty string (aka $wgSubpageSortkeyByNamespace = '2';
on a page with no subpages) Setting it to true
(default) means it will use the page's title as the sortkey. Setting to false
means it will use the empty string.
The full page name (minus the namespace name) will be used as a tie-breaker in sorting. You can still use {{DEFAULTSORT:foo}}
to override this extension.
Download instructions
Installation
To install this extension, add the following to LocalSettings.php :
require_once("$IP/extensions/SubpageSortkey/SubpageSortkey.php");
$wgSubpageSortkeyDefault = '-1';
$wgSubpageSortkeyByNamespace[NS_TALK] = '2..4';
And then run the maintenance script updateCollation.php --force
(important!)
As of MW 1.39, it seems that this extension must be loaded with
wfLoadExtension( 'SubpageSortkey' );
See also
File:Wikimedia-logo black.svg | <translate> This {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is being used on one or more [[<tvar name=2>m:Special:MyLanguage/Wikimedia projects</tvar>|Wikimedia projects]].</translate> <translate> This probably means that the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is stable and works well enough to be used by such high-traffic websites.</translate> <translate> Look for this {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension's|skin's}} name in Wikimedia's <tvar name=2>CommonSettings.php</tvar> and <tvar name=3>InitialiseSettings.php</tvar> configuration files to see where it's installed.</translate> <translate> A full list of the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extensions|skins}} installed on a particular wiki can be seen on the wiki's <tvar name=ver>Special:Version</tvar> page.</translate> |
- Pages with script errors
- Pages with broken file links
- Stable extensions
- Extensions without an image
- Extensions with invalid or missing type
- Extensions without a compatibility policy
- Extensions with manual MediaWiki version
- GPL licensed extensions
- Extensions in Wikimedia version control
- GetDefaultSortkey extensions
- All extensions
- Extensions used on Wikimedia
- Category extensions
- Subpage extensions