Extension:CategorySortHeaders

Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:GPL licensed extensions
MediaWiki extensions manual
CategorySortHeaders
Release status: stableCategory:Stable extensions
Implementation Hook Category:Hook extensions
Description Make custom headings in category pages, instead of just the first character headings
Author(s)
Latest version 0.4.0 (2021-04-20)
MediaWiki 1.35+Category:Extensions with manual MediaWiki version
Database changes No
License GNU General Public License 2.0 or later
Download Category:Extensions in Wikimedia version control
  • $wgCategorySortHeaderAppendPageNameToKey
Quarterly downloads 5 (Ranked 87th)
Translate the CategorySortHeaders extension if it is available at translatewiki.net
Category:All extensions

The CategorySortHeaders extension to allow specifying custom multi-character 'first-character' sorting headers to list pages under in categories, using syntax like [[Category:Foo|^Header^Invisible part of sortkey]] or even just [[Category:Foo|^Header^]].

Usage

If you want a category to use a custom header, do [[Category:Cat name|^header^OptionalInvisibleSortkey]] (or {{DEFAULTSORT:^header^Optionalsortkey}}. If you want to use the default first letter headers, just use categories as normal.

Installation

  • Download and move the extracted CategorySortHeaders folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CategorySortHeaders
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'CategorySortHeaders' );
    
  • Run either update.php or updateCollation.php from the command line (Note that running the web installer in upgrade mode does not work due to T19335)
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed. Category:Extensions still supporting pre-registration versions

To users running MediaWiki 1.35 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension(). If you need to install this extension on these earlier versions (MediaWiki 1.35 and earlier), instead of wfLoadExtension( 'CategorySortHeaders' );, you need to use:

require_once "$IP/extensions/CategorySortHeaders/CategorySortHeaders.php";
Warning Warning: Do not set $wgCategoryCollation in LocalSettings.php . This extension defines its own collation, and must use that.

Configuration

This extension has a single configuration option:

$wgCategorySortHeaderAppendPageNameToKey
It defaults to true, which causes a sortkey of ^foo^ to be treated like ^foo^{{PAGENAME}}. If it is set to false, it will sort ^foo^ above ^foo^<any string here>. (In both cases, if there are two exactly same sort keys, the pagename will be used as a tie breaker.) After changing this option you should run:
php updateCollation.php --force
If anyone likes the idea of this extension, but wants to use the uca-default collation instead of uppercase - let me (bawolff) know. It probably wouldn't be very difficult to modify this extension to make it work with uca-default

See also

Category:Category extensions
Category:All extensions Category:Category extensions Category:Collation::factory extensions Category:Extensions in Wikimedia version control Category:Extensions included in Miraheze Category:Extensions included in WikiForge Category:Extensions still supporting pre-registration versions Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:GPL licensed extensions Category:Hook extensions Category:Stable extensions