Extension:Advanced Meta

From MediaWiki.org
Jump to: navigation, search
This extension is currently being overhauled. Sit tight. --14:59, 6 June 2014 (UTC)
MediaWiki extensions manual
Crystal Clear app error.png
Advanced Meta

Release status: unstable

Implementation Page action, Database
Description allows per page editing of various meta tags for SEO reasons
Author(s) Bart van Heukelom, Zayoo (Talk) Litso, Swidmann (Talk)
Latest version 2.0.1 (2011-03-02)
MediaWiki 1.15+
PHP 5.2+
Database changes Yes
License GNU General Public License
Download Template:WikimediaDownload/svn
Example File:AdvancedMeta-screenshot.png
Hooks used
ParserBeforeTidy

ArticleSave
OutputPageBeforeHTML
ArticleInsertComplete
BeforePageDisplay
LoadExtensionSchemaUpdates

Translate the Advanced Meta extension if it is available at translatewiki.net

Check usage and version matrix; code metrics
A screenshot of the Advanced Meta plugin

The Advanced Meta 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.


Usage[edit | edit source]

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[edit | edit source]

Download the files from SVN OR Download Snapshot. AdvancedMeta consists of 3 files:

  • AdvancedMeta.i18n.php
  • AdvancedMeta.php
  • AdvancedMeta.sql (a SQL script)

Place the .php files in the extensions directory $IP/extensions/AdvancedMeta/

Backup your wiki's database using MySQL Workbench, phpMyAdmin, command-line, etc... (advised prior to executing AdvancedMeta.sql query)

Execute the AdvancedMeta.sql query. A table should be added to the mediawiki database. The following SQL should take care of that:

CREATE TABLE /*_*/ext_meta (
  `pageid` INT(8) NOT NULL,
  `rindex` tinyint(1) NOT NULL,
  `rfollow` tinyint(1) NOT NULL,
  `titlealias` VARCHAR(255),
  `keywords` text,
  `description` text,
  PRIMARY KEY  (`pageid`)
) /*$wgDBTableOptions*/

In LocalSettings.php add this line

require_once( "$IP/extensions/AdvancedMeta/AdvancedMeta.php" );

Add the page Mediawiki:Globalkeywords into your own wiki and write the global keywords there, splitted in commas (,).

There are some settings you can change in LocalSettings.php. Possible settings are namespaces that are indexed by default (default setting: NS_MAIN and NS_PROJECT), and users/usergroups that are allowed to edit the meta settings (default: sysop and bureaucrat).

To set these settings, add this line first

$mwaMeta = MWAdvancedMeta::setup();

Then add one or more of these lines

$mwaMeta->setAllowedUsers(array('Mary', 'Anne'));
$mwaMeta->setAllowedUsergroups(array());
$mwaMeta->setIndexedPages(array(NS_MAIN, NS_PROJECT, NS_IMAGE, NS_TALK));
Warning: If you don't set these rules, by default all sysops and bureaucrats can modify meta information

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).

Compatibility[edit | edit source]

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.

It is incompatible with Manual:ImportImages.php

Change log[edit | edit source]

  • Version 2.0.1
    • Fixed robots policies for MediaWiki 1.16.0 and higher
  • Version 2.0.0 (by Zayoo)
    • Added internationalization (i18n) and added TitleAlias input box. Allow $1 for FULLPAGENAME
    • Function for TitleAlias. Recreate the HTML title with Mediawiki:Pagetitle.
    • Relocated some functions to better positions
    • Fixed a bug in usergroup names
    • Use Mediawiki:Globalkeywords instead of $globalKeywords so that sysops can change it conveniently and support UTF-8 charactors. $globalKeywords has been removed. Also still show the global keywords if no meta record for this article.
    • If the meta information is normal (index, follow, no titlealias, no keywords, no description), DELETE the record instead of INSERT or UPDATE to save space in database.
  • Version 1.3.0 (by Bart van Heukelom)
    • Encapsulated the entire plugin in an object (PHP 5 only).
  • Version 1.2.1
    • Improved permission check for editing/updating meta info
    • Noindex redirect pages as well
  • Version 1.2.0
    • Added a hook to move meta data for a new article from a temporary place (article id 0) to it's new article id
  • 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