MediaWiki Tricks
MediaWiki Tricks
Changing the <title> of a page
I wanted my user page to have the title "Tim Styles" when displayed by search engines, but the MediaWiki default produced "User:Tim - Tim's website". I had a look at various options, such as MediaWiki:pagetitle, but this affects all pages. In the end I modified the PHP file (mediawiki/skins/Modern.php in my case) as follows:
<title><?php $this->text('pagetitle') ?></title>
<title><?php if (strpos($this->data['pagetitle'],"User:Tim") === false) { $this->text('pagetitle'); } else { echo "Tim Styles"; } ?></title>
You can do the same thing for the Main Page. Just change the second line above to the following:
if (strpos($this->data['pagetitle'],"Main Page") === false) {
This will not affect the name of the Main Page, just the <title>, which is displayed by search engines and shown in the title bar of most browsers. All other pages will be unaffected and their titles will remain as "Page Name - Site name".
Make sure you edit the skin you are using. This is set by $wgDefaultSkin in your LocalSettings.php file.