Page MenuHomePhabricator

CSS class needed for "Main page"
Closed, ResolvedPublic

Description

Monobook puts a CSS ID in the BODY to tell us what namespace we're in, but "Main
page" is a kind of special page in the main namespace, and sometimes we don't
want CSS to affect it in the same way as an article page. Currently Javascript
is required to detect if the current page is "Main page", and even that will not
be portable when "Main page" has another name.


Version: unspecified
Severity: enhancement

Details

Reference
bz5795

Event Timeline

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

Set body id attribute to page name

The attached patch sets the "id" attribute of the HTML "body" tag to the page
title (escaped in the same manner as section anchors). This enables the
creation of CSS rules that only apply to the main page, _or_ to any other given
page, like this:

BODY#Main_Page H1 { display: hidden; }  /* hide title on main page */

Attached:

ayg wrote:

Added in r17119 based on Ilmari's patch, see also r17120. Added as a class
instead of an id, for more flexibility in character choice (Unicode is allowed
in classes) and generally the purpose of the two. Prefixed with "page-" to
avoid messy collisions.