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
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
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T31928 Show translated titles per user language in categories too | |||
Open | Feature | None | T2491 Categories need piping feature to list by alternative name | ||
Open | Feature | None | T31975 Provide a way to alter page titles in category listings, e.g. via display title | ||
Open | None | T19212 Use {{DISPLAYTITLE}} as link label on category pages | |||
Resolved | None | T22278 Cache DISPLAYTITLE to use it in categories and for tooltips | |||
Declined | None | T55945 A cheap way to get information from page_props table for all links on page (similar to LinkCache?) needed |
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; /*yourfont(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 prefixdisappears*/
}
/* 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; /*yourfont(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 prefixdisappears*/
}
/* 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; /*yourfont(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 prefixdisappears*/
}
/* 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:", "");
})
*/
(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).
Sorry for the duplicate bug.
Suggest that a new magic word {{DISPLAYCAT}} be created.
Suggest can duplicate most of the code for this from that for {{DISPLAYTITLE}}, including restrictions in localsettings.php
Often the value will be the same as the {{DISPLAYTITLE}} value, but probably not always and some might like to remove the namespace or replace NS with emoji. (Project categories can get very ugly if they ate filled with Project:this and Project:that). So it should be independent of {{DISPLAYTITLE}}.
Another way should also be found to mark redirects in categories rather than italicising them. Suggest adding (redirect) after the pagename.
Forget about {{DEFAULTSORT}} that's totally different.
The community will find a way to populate the {{DISPLAYCAT}} magic word quickly.
Pps actually there may be some relevant code in {{DEFAULTSORT}} -- the category page fetches the {{DEFAULTSORT}} values of all its members. It will also need to fetch the {{DISPLAYCAT}} values for each of those members and then display those values in lieu of the pagename. If that makes sense.
And this bug is 10 years old....? It should be higher priority because it affects the public view of the wiki.