[Mediawiki-l] Style pages based on category, possible?

Bernard@bernardHulsman.nl bernard at bernardhulsman.nl
Wed Jan 27 13:01:53 UTC 2010


Yes it is. See http://handleiding.wikiation.nl/MediaWiki:Common.css for 
the definition and
http://handleiding.wikiation.nl/Niveau_2_infobox_gebruiken for the 
implementation of that definition.

I use it to mark pages with a "Timecode". Normal pages are "now", but 
some are "Timecode-future". The content is written but not yet 
implemented in the real live. So I add this category. If the content is 
"now", the only thing I have to do is remove the category.

But be aware. A category may have multiple parents in MediaWiki. If you 
use multiple parents AND you use multiple styles, then the result will 
be unpredictable.

Good luck.


Jean-Marc van Leerdam wrote:
> Hi,
> What is the best approach to support styling MW pages based on the
> category (categories) the page belongs to?
> I was hoping the category name could be inserted in the class
> attribute just like the namespace and pagename appear there, but I did
> not find any configuration setting indicating that this is possible at
> the moment.
> Thanks in advance for your suggestions.

More information about the MediaWiki-l mailing list