How to hide page titles in MediaWiki

If you want to remove the heading of one or more pages of your MediaWiki site, there are different methods you can do that. It's possible to hide the titles only of a certain page or pages, you can do that for all the pages of a selected namespace, or you can hide the titles of all pages on the site.

There are a couple of easy ways you can do that:

In this article we'll go over both methods.

Remove Page Titles with the Magic Word DISPLAYTITLE

In MediaWiki you can perform various things with the so called magic words. In this case you can use the magic word DISPLAYTITLE. With this method you can hide titles per page. The code that's used is the same for any page and it's the same regardless of the skin. This means that once you make the change to a page it will work with any skin.

However, if you have to remove the titles of all pages or of a great number of pages, this method may not be very suitable since you have to edit each page.

To hide the title of a page, edit that page and in its content add the following:

{{DISPLAYTITLE:<span style="position: absolute; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);">{{FULLPAGENAME}}</span>}}

Once you save the change the title should be removed.

Remove Page Titles with CSS Modifications

With a simple CSS (Cascading Style Sheet) modification you can hide the title of a particular page, of all the pages from a namespace, or of all pages on the site. Whatever the case, the code that you have to use has the following form:

element { display: none; }

where element has to be replaced with the tag and/or ID with which the title is identified in the skin. This means that a modification that works with one skin may not work with another, if different IDs are used in the particular skins.

You can make a CSS modification by adding it to the content of the page MediaWiki:Common.css on your site (e.g. This will affect all skins that use the same ID for the title. If you want only a particular skin to be affected, you can add the modification only to the CSS page of that skin (e.g. MediaWiki:Vector.css for the Vector skin). For more information on making CSS changes check out the article on how to make CSS modifications in MediaWiki. There you'll also find tips on how to find out with what tag (and ID or class) the title is defined in the skin that you use.

Now we'll go over how to remove the titles of all pages, per namespace, or per page.

Hide the Titles of All Pages

The following CSS modification will work with most skins:

h1 { display: none; }

It will work with the prepackaged skins Vector, MonoBook, Modern and Cologne Blue, and with many other skins. Usually the tag h1 is used to define page titles. However in some skins there might be other text elements (e.g. site title) that are defined with h1. If this is the case, the modification will also affect this other element(s).

If the above modification affects other elements in the skin that you use, then you can add to the code the ID or class, for example, of the content of the page. This will further limit the scope of the code. The IDs are skin-specific. Some skins use the same ones, but in others they may be different. As an example we'll use the prepackaged skins Vector, MonoBook, Modern, Cologne Blue (though the code h1 {display: none; } will work fine with them).

Vector and MonoBook: #content h1 { display: none; }

Modern: #mw_header h1 { display: none; }

Cologne Blue: #article h1 { display: none; }

Hide Titles per Namespace

To hide the titles of all pages of a particular namespace, you only have to add in front of the code for removing the titles of all pages the namespace to which you want the change to be applied. This is done in the following way:

.ns-1 h1 { display: none; }

This will remove the page titles of pages that belong to the namespace with the ID number 1. That's the Talk namespace that contains the discussion pages of articles. You simply have to put the ID number of the namespace to which you want the change to apply. For a list of the default namespaces and their ID numbers check out the reference list of MediaWiki namespaces.

Hide Titles per Page

If you decide to use CSS to hide the title of a specific page, in front of the general code for removing the titles of all pages, you have to add some code for the name of the page to which you want the change to apply. For example: h1 { display: none; }

will remove the heading of the page titled Main Page (that's the default home page). Just replace Main_Page with whatever the name of the particular page is. Put underscores _ between words. If the page belongs to a namespace other than the Main namespace, then you also have to add to the title of the page the namespace prefix (e.g. h1 { display: none; } will remove the title of the discussion page associated with Main Page).

For more modifications related to page titles, as well as for other CSS modifications in general, you may find useful the following articles in our knowledge base:

Was this answer helpful?

 Print this Article

Also Read