How to remove the links for editing page sections in MediaWiki

As you know you can divide the content of pages into sections. Each such section has a section heading which can also be referred to as a subheading of the page title. By default, next to each subheading there's an edit button with which users can edit only the content of that particular page section. When the user clicks on it the edit form is opened with the content of the selected section. Of course, these edit buttons are available only to users who have the permission to edit content.

If you want to, you can hide these edit buttons for page sections. This can be done with a simple CSS (Cascading Style Sheets) modification. For general information on CSS changes check out the article on how to make CSS modifications in MediaWiki.

In the prepackaged skins that come with MediaWiki the edit button for page sections is defined with the class .mw-editsection. To remove the links you have to add it to the MediaWiki:Common.css page of your site (e.g. together with the CSS code for hiding the link. This same class is used for most other skins, but this is skin-specific. In some skins the page section link may be defined differently.

You can remove the page section edit links from all pages; you can do it per namespace or you can remove them only from a specific page(s).

Remove Page Section Links from All Pages

To disable the edit links for page sections on all pages, you can use the following code:

.mw-editsection { display:none; }

Remove Page Section Links Per Namespace

You can hide the edit links for page section only on the pages from a particular namespace. You can do this with code that looks like this:

.ns-2 .mw-editsection { display: none; }

You only have to put the ID number of the specific namespace to be affected. In the above example the button will be removed from the pages of the namespace with the ID number 2; that's the namespace that contains the personal user pages. For information on the default namespaces and their ID numbers check the references list of MediaWiki namespaces.

Remove Page Section Links per Page

You also have the option to remove the edit links of page sections only from particular pages. This can be done with the following: .mw-editsection { display: none; }

This will remove the edit links of the page sections of a page titled Example Page. When you use the code you only have to replace the name of the page. The words in the name of the page should be separated with underscores _. If the page belongs to a namespace other than the Main one, in the code you also have to separate the namespace prefix from the page name with an underscore (e.g. Talk_Example_Page).

You may find also find useful the following articles with CSS modifications in our knowledge base:

Was this answer helpful?

 Print this Article

Also Read