Web Development

Jack Reichert

How to Add META Tags – ROBOTS NOFOLLOW,NOINDEX – to Your MediaWiki Site Head

I spent too much time today hunting down how to do this, so I thought I’d spell it out clearly.

Add the following snippet to your LocalSettings.php OR includes/OutputPage.php file and it will insert the META tag ROBOTS NOINDEX, NOFOLLOW into the header.

As you know, the ROBOTS NOINDEX, NOFOLLOW tag will tell search engines not to index your site.

Why would you want that? Any number of reasons: you’re still developing it, it’s a private wiki for just you or a small group of people or maybe you want to block search engines to just to spite them.

The above snippet can be modified and used to insert any meta tag into the header of your mediawiki site.

I placed the code after defining the theme in my LocalSettings.php page and it worked beautifully. Not sure where specifically it should go. Please comment below if you know of a “best placement” for the code.

Tags: ,
Category: Reference

Bill FreedmanFebruary 7th, 2012 at 11:57 am

Nice article on a timely topic for me.

I’m struggling to be able to manage robots meta tags at the individual page level. For example, specifying that a page behind a registration wall doesn’t get indexed. The way our site is configured IT, doesn’t provide me with the ability to change robots.txt…they need to do it for me.

I’m hoping to find a plugin that can achieve this at the page level. I’m going to test out Robots Meta. My concern is that the plugin hasn’t been updated in quite a while. Any thoughts?

Jack ReichertFebruary 9th, 2012 at 8:12 pm

Hmm, I’ll see if I can find anything about that.

I posted this article because there seems to be very little, easily found, about MediaWiki.

Leave a Response