Page MenuHomePhabricator

Provide a way to alter page titles in category listings, e.g. via display title
Open, NormalPublic

Description

There should be a way to not use the actual page titles but something else instead in the category listing. Would be useful for example translated titles.


Version: unspecified
Severity: enhancement

Details

Reference
bz29975

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 21 2014, 11:35 PM
bzimport added a project: MediaWiki-Categories.
bzimport set Reference to bz29975.
bzimport added a subscriber: Unknown Object (MLST).

Would be very useful to me at the moment. I'm having a discussion about a custom namespace on a wiki I administrate, and the major concern seems to that the pages in the namespace show up as NS:foo instead of just foo on the category pages.

I cogitated a workaround that seems to work for me in css..
There has to be a better way though....

/* strip "NS:" namespace from category pages fix */
a[title^='NS:'] {

font-family: 'Lucida Grande', Geneva, Arial, Verdana, monospace; /*your font(s) +", monspace"*/
font-size: 12px; /*Set to whatever font-size those items currently use*/
display: inline-block;
overflow: hidden;
text-indent: -1.5em; /*fudge this number until your namespace prefix disappears*/

}
/* strip "NS:" namespace from category pages fix end */

(In reply to comment #2)

I cogitated a workaround that seems to work for me in css..
There has to be a better way though....
/* strip "NS:" namespace from category pages fix */

div#mw-pages /*declare the category listing section*/

a[title^='NS:'] {

font-family: 'Lucida Grande', Geneva, Arial, Verdana, monospace; /*your

font(s) +", monspace"*/

font-size: 12px; /*Set to whatever font-size those items currently use*/
display: inline-block;
overflow: hidden;
text-indent: -1.5em; /*fudge this number until your namespace prefix

disappears*/
}
/* strip "NS:" namespace from category pages fix end */

(In reply to comment #2)

I cogitated a workaround that seems to work for me in css..
There has to be a better way though....
/* strip "NS:" namespace from category pages fix */
a[title^='NS:'] {

font-family: 'Lucida Grande', Geneva, Arial, Verdana, monospace; /*your

font(s) +", monspace"*/

font-size: 12px; /*Set to whatever font-size those items currently use*/
display: inline-block;
overflow: hidden;
text-indent: -1.5em; /*fudge this number until your namespace prefix

disappears*/
}
/* strip "NS:" namespace from category pages fix end */

That's disgusting :P

(In reply to comment #4)

(In reply to comment #2)

I cogitated a workaround that seems to work for me in css..
There has to be a better way though....
/* strip "NS:" namespace from category pages fix */
a[title^='NS:'] {

font-family: 'Lucida Grande', Geneva, Arial, Verdana, monospace; /*your

font(s) +", monspace"*/

font-size: 12px; /*Set to whatever font-size those items currently use*/
display: inline-block;
overflow: hidden;
text-indent: -1.5em; /*fudge this number until your namespace prefix

disappears*/
}
/* strip "NS:" namespace from category pages fix end */

That's disgusting :P

Yes, but it visually worked.. For those that can use JavaScript, there is an alternative:

/*
Namespace Stripping
Fix by DDOwiki User:Ague
20 April 2012
*/
$('a[title^="Item:"]').each(function() {

this.innerHTML = this.innerHTML.replace("Item:", "");
this.title = this.title.replace("Item:", "");

})
/* Leave final semi-colon out. When MW parses this, for some reason it automatically adds a semi-colon. */

/* Optionally, un-comment the code below to strip the Item: from the page title as well.

MAKE SURE TO ADD THE SEMI-COLON AFTER THE }) ABOVE IF YOU UN-COMMENT BELOW! */

/*
$('h1#title').each(function() {

this.innerHTML = this.innerHTML.replace("Item:", "");

});
$('title').each(function() {

this.innerHTML = this.innerHTML.replace("Item:", "");

})
*/

Could {{DEFAULTSORT}} be modified to do this?

(In reply to comment #6)

Could {{DEFAULTSORT}} be modified to do this?

This bug is about giving this possibility in core, not about providing an interface for it. For instance, it would be used by bug 29928.

(In reply to comment #6)

Could {{DEFAULTSORT}} be modified to do this?

I think it would be possible to write an extension that would use defaultsort to do that, but it would be hacky beyond hacky so I wouldn't reccomend it.

(In reply to Bawolff (Brian Wolff) from comment #8)

I think it would be possible to write an extension that would use
defaultsort to do that, but it would be hacky beyond hacky so I wouldn't
reccomend it.

Display title / DISPLAYTITLE (which by default is restricted to case changes) is probably the most sensible property to reuse so I'm marking it as blocker, but this bug may be solved in other ways as well, as long as it allows Translate to set/use it (bug 29928).

Blahma added a subscriber: Blahma.Jun 2 2015, 10:25 AM
Kghbln added a subscriber: Kghbln.Nov 3 2015, 2:30 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 3 2015, 2:30 PM
Kghbln awarded a token.Nov 3 2015, 2:30 PM
Nemo_bis rescinded a token.Jul 16 2016, 8:00 AM
Nemo_bis awarded a token.