Page MenuHomePhabricator

Possibility to ignore namespace in sorting categories
Closed, ResolvedPublic

Description

On Wikis with two or more content namespaces, categories don't look so nice because all articles of a namespace (say Help:) are grouped under "H" by default.

This patch introduces the option to completely ignore the namespace for sorting in category pages.

  • a/includes/DefaultSettings.php

+++ b/includes/DefaultSettings.php
@@ -2114,6 +2114,12 @@ $wgCategoryMagicGallery = true;
$wgCategoryPagingLimit = 200;

/
+ * Sort pages in categories by namespace first (e.g. group all Talk pages together)
+ * Warning: This will only affect newly saved pages!
+ */
+$wgUseNamespaceInCategorySort = true;
+
+/

  • Browser Blacklist for unicode non compliant browsers
  • Contains a list of regexps : "/regexp/" matching problematic browsers */
  • a/includes/Parser.php

+++ b/includes/Parser.php
@@ -4866,10 +4866,11 @@ class Parser

  • @return string */ public function getDefaultSort() {

+ global $wgUseNamespaceInCategorySort;

		if( $this->mDefaultSort !== false ) {
			return $this->mDefaultSort;
		} else {
  • return $this->mTitle->getNamespace() == NS_CATEGORY

+ return ($this->mTitle->getNamespace() == NS_CATEGORY || !$wgUseNamespaceInCategorySort)

					? $this->mTitle->getText()
					: $this->mTitle->getPrefixedText();
		}

Comments?


Version: 1.12.x
Severity: enhancement

Details

Reference
bz12351

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:57 PM
bzimport set Reference to bz12351.
bzimport added a subscriber: Unknown Object (MLST).

(In reply to comment #0)

On Wikis with two or more content namespaces, categories don't look so nice
because all articles of a namespace (say Help:) are grouped under "H" by
default.

Comments?

Consistently using [[Category:Mycat|{{PAGENAME}}]] solves this issue.

WONTFIX?

Yes, using [[Category:Mycat|{{PAGENAME}}]] (or even {{DEFAULTSORT:{{PAGENAME}}}}) works, but isn't this a bit hard on the users?

IMHO, manually doing this just wastes time. We already do this for categories, so I think it makes sense to allow it for other namespaces, too.

Fixed in r38992, configuration variable is $wgCategoryPrefixedDefaultSortkey.

  • This bug has been marked as a duplicate of bug 6387 ***