Extensions Google SiteMap

From Triangle Wiki

Jump to: navigation, search

Contents

Introduction

Extensions Google SiteMap extension implements a Special:GoogleSitemap page which allows you to automatically create and update a Google Sitemap for a particular Mediawiki setup. This essentially allows google to perform smarter explorations of it.

The Special:GoogleSitemap page is designed for bureaucrats/administrators. It saves a XML Sitemap file called sitemap.xml (at the root of the wiki by default) and prints some reporting (quite similar to Special:Popularpages).

The XML file has the following properties:

  • It is sorted by decreasing article popularity (ie. highest number of hits).
  • It contains articles only : no redirection pages, nor any other special/external page (google robots will do these, probably).
  • It does not include pages in the reserved Mediawiki namespace (nor in the associated talk namespace).

In order to produce more relevant Sitemaps, Extensions Google SiteMap can also estimate the revision frequency of your pages and associate them a priority according various schemes.

Usage

  • First step

Visit the Special:GoogleSitemap page, then give google the url of the file that was just created (a link will be provided).

  • Update

On a regular basis, visit Special:GoogleSitemap as a bureaucrat, or do some server-side trickery at your own risk ;).

  • Parameters

The Special:GoogleSitemap page accepts the limit and offset parameters, eg: Special:GoogleSitemap&limit=250, will build a Sitemap out of the 250 'best' articles (so beware when navigating this page, as it will produce a new sitemap each time, you'll be warned though).

Installation

  • Firstly create a file named GoogleSitemap.php and place this in the wiki extensions directory
  • Copy all the source code below into that file.
  • To activate the extension, include it from your LocalSettings.php.
  • Add the code require_once 'extensions/adsense.php';
  • Secondly create a file named SpecialGoogleSitemap.php and place this into the wiki include directory
  • Copy all the source for the code for SpecialGoogleSitemap below into that file.

GoogleSitemap.php Source Code

<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * Google Sitemap WikiMedia extension.
 *
 * Firstly create a file called google_sitemap.php.php and
 * place this in the extensions directory - copy all this
 * code to that file. To activate the extension, include
 * it from your LocalSettings.php with:
 * require_once 'extensions/GoogleSitemap.php';
 *
 * PHP versions 5
 *
 * LICENSE: This source file is subject to version 3.0 of the
 * PHP license that is available through the world-wide-web at
 * the following URI: http://www.php.net/license/3_0.txt.
 * If you did not receive a copy of the PHP License and are
 * unable to obtain it through the web, please send a note to
 * license@php.net so we can mail you a copy immediately.
 *
 * @category   Wiki
 * @package    googleSitemap
 * @author     Ian Warner
 * @copyright  2006 Triangle Solutions Ltd
 * @license    http://www.php.net/license/3_0.txt PHP License 3.0
 * @version    SVN: $Id: $
 * @link       http://www.triangle-solutions.com/
 */

/*
 * @todo Document 
 */
$wgExtensionFunctions[] = 'wfExtensionSpecialGoogleSitemap';

/*
 * Extension credits
 */
$wgExtensionCredits['specialpage'][] = array(
 'name' => 'Special:GoogleSitemap',
 'description' =>
  'Adds a Special page to create a Google Sitemap file',
 'url' =>
  'http://wiki.triangle-solutions.com/index.php/Extensions',
 'author' => 'Triangle Solutions Ltd',
 'version' => '1.0.1');

/**
 * @todo Document
 */
function wfExtensionSpecialGoogleSitemap()
{
    global $wgMessageCache;
    $wgMessageCache->addMessages(
      array('googlesitemap' => 'Google Sitemap')); 
    $wgAvailableRights[] = 'googlesitemap';
    $wgGroupPermissions['bureaucrat']['googlesitemap'] = true;
    SpecialPage::addPage(new SpecialPage('GoogleSitemap',
      'userrights'));
}
?>

SpecialGoogleSitemap.php Source Code

External Links


Personal tools