Knowledgebase

How to remove the top navigation page tabs in MediaWiki

In MediaWiki there are some page tabs with which various actions can be performed with that page. With most skins these tabs are located at the top of the page, just above its title, but depending on the skin they may be located elsewhere (e.g. the left menu). Some skins may also have corresponding buttons located at two different places on the page; for instance, the Cologne Blue skin that comes prepackaged with MediaWiki has page tabs in the left menu and also at the bottom of the page.

The page tabs include Page, Discussion, Edit, View history (or just History, depending on the skin), Watch/Unwatch, Delete, Move, Protect, Read.

In this article we'll show you how to remove these tabs. You can do that for all pages on the site or just for specific pages. This can be achieved with some simple CSS (Cascading Style Sheet) modifications. Note that removing a tab doesn't mean that the page that it links to can't be accessed anymore; users will still be able to access the corresponding page by directly opening its URL address. But in general this will significantly reduce the traffic to the pages of the removed tabs because most people will not bother or won't know the corresponding URL addresses.

The CSS modifications can be performed on the frontend of the site. If you want the whole site to be affected you can make the modification by editing the page MediaWiki:Common.css. To access the page just add that page name to the base URL of your site. For example, if the homepage of the site is yourdomain.com, then you can access the page at yourdomain.com/index.php/MediaWiki:Common.css. If you want the modification(s) to be applied only to a particular skin, you can edit the CSS page of that skin instead of the page MediaWiki:Common.css. For example, the CSS page of the Vector skin is MediaWiki:Vector.css (e.g. yourdomain.com/index.php/MediaWiki:Vector.css).

These CSS pages can be edited by users belonging to the admin/sysop user group.

In this article we'll use as examples the skins that come prepackaged with MediaWiki: Vector, Monobook, Modern and Cologne Blue. The suggested modifications will work for most other skins as well, but there might be some skins for which the IDs that are used in the code for the tabs are different. There are useful ways to check the IDs of elements (in this case page tabs) using your web-browser. With Mozilla Firefox there's a very useful extension called Firebug that you can use for this purpose. With Google Chrome click with the right mouse button on an element on the page and from the menu that appears select Inspect element.

After you make a CSS modification, in order to see the result on the frontend, clear the browser cache and refresh the page.

Remove Tabs from All Pages

Regardless of which tab you want to remove, the code that you have to use is the same. The only difference is that you have to use the ID of the specific tab. For example, to remove the Discussion tab from all pages, add the following to the MediaWiki:Common.css page:

#ca-talk { display:none!important; }

In this case the ID is #ca-talk. To remove another tab you only have to replace the ID and use the one for the tab that you want to hide. For instance, to remove the Delete tab edit the page MediaWiki:Common.css and add the following on a new line:

#ca-delete { display:none!important; }

In the last section of this article you'll find listed the IDs of the different tabs.

The above modifications will work with all the prepackaged skins (Vector, Monobook, Modern, Cologne Blue), and with most other skins, if not all.

Remove Tabs from Specific Pages

It's also possible to remove a tab only from a particular page(s) of your choice. For example, the following:

body.page-Main_Page li#ca-delete { display:none!important; }

will hide the Delete tab on the Main Page. The code is the same for removing other tabs on different pages. You only have to replace the ID of the tab and the name of the page. In the above example the ID of the tab is #ca-delete and the name of the page Main_Page.

So, for example, if you want to remove the Discussion tab on a page with name Example Page, you have to use the code:

body.page-Example_Page li#ca-talk { display:none!important; }

If the name of the page consists of more than one word, put underscores between the words.

IDs of Page Tabs

As we explained, each tab has an ID with which it's defined. The IDs may be skin-specific, but generally they are the same for all skins. To remove a tab you only have to put its ID in the code modifications listed above in this article. Here's a list of the IDs of the different tabs:

#ca-nstab-main - Page tab

#ca-nstab-user - User page tab (the Page tab on personal user pages)

#ca-talk - Discussion tab

#ca-view - Read tab (from the prepackaged skins this tab is available only in the Vector skin)

#ca-edit - Edit tab

#ca-history - View history/History tab

#ca-watch - the Watch tab for adding the page to the watchlist

#ca-unwatch - the Unwatch tab for removing the page from the watchlist

#ca-delete - Delete tab (in the Vector skins it's displayed with the More drop-down menu)

#ca-move - Move tab (in the Vector skin it's part of the More drop-down menu)

#ca-protect - Protect tab (as the previous two, with the Vector skin it's in the More drop-down menu)

#ca-viewsource - View source tab; this tab is available for users who belong to user groups that don't have the permission to edit pages. With it the user can view the source text of the page without being able to modify it.

When it comes to the prepackaged skins that come with MediaWiki, as we explained, the Cologne Blue skin has page tabs in the left menu and also at the bottom of the page. The above IDs will work for the buttons in the left menu. Those at the bottom have slightly different IDs: e.g. #cb-ca-talk, #cb-ca-edit, etc. As for removing these buttons from specific pages you also have to take out the li part of the code (e.g. body.page-Example_Page #cb-ca-talk { display:none!important; }).

For other CSS modifications you may find helpful the following articles:

Was this answer helpful?

 Print this Article

Also Read