Extension:AdvancedMeta

This extension allows setting the robots, keywords and description meta tags for MediaWiki, for SEO purposes. Meta settings can be edited for individual pages, or entire namespaces can be denied from indexing by robots.

This is my first real plugin. Please do send me corrections or tips, or even update the code if you have better ideas.

Usage
Pages that are not excluded from indexing (see Installation) will have an extra section in their edit pages, as shown in the screenshot. These forms allow you to add meta keywords and a description, as well as setting the robots meta tag to index and/or follow your page. If the "index"-checkbox is disabled, keywords and descriptions are of no use obviously, but they will be saved in case you want to have the page indexed later.

Installation
To install the plugin, upload the source code below in a file called AdvancedMeta.php in the folder /extensions/AdvancedMeta/ in your MediaWiki main folder. In LocalSettings.php add the line

Make sure to edit the global settings in the top of the source code to your preference. Possible settings are namespaces that are indexed by default (default setting: NS_MAIN and NS_PROJECT), keywords that are added to every single page, and users/usergroups that are allowed to edit the meta settings.

Namespaces that are not in the 'indexedpages' variable will get a "noindex,follow" by default. There is currently no setting to also prevent them from being followed, but I might add that sooner or later depending on if it's being requested (feel free to contact me).

Last, a table should be added to the mediawiki database. The following SQL should take care of that:

Compatibility
I'm not sure how this extension works combined with other meta plugins, but I'm afraid the ones that also work with keywords and descriptions will collide.

Change log

 * Version 1.1.0:
 * Added a notification on the edit page which keywords are always used
 * Added the 'always used' keywords to pages with no user-defined keywords as well
 * Fixed edit conflict for pages that are not indexed
 * Added freeResults to the getMetaByArcticleID query


 * Version 1.0.0:
 * Set meta robots="noindex/follow" to entire namespaces
 * Set default meta keywords that are added to all indexed pages
 * Allow specific users or usergroups to edit meta information to indexed pages
 * Add/modify robots, keywords and descriptions for individual pages