Google XML Sitemap Creator

Summary: Create an XML sitemap in the root of the website which is suitable for submission to Google (and other) search engines.
Version: 20231026
Prerequisites: PmWiki 2.2.56 or newer
Status: Active
Maintainer: DaveCooke
License: GPLv3+
Users: (view / edit)
Discussion: GoogleSiteMap-Talk

Description

This a simple, hopefully fast means of producing an XML site map.

  • The script is a basic run-out-of-the-box script.
  • The scripts take into account whether clean URLs are in use or not and produces the sitemap accordingly.
  • The production is triggered by the inclusion of the the action - ?action=sitemap or can be set to be re-created every few page edits (pre-set to 20 but alterable).
  • When production of the sitemap is completed, a return will be made to the original page.
  • Last tested on PmWiki version: pmwiki-2.1.beta22 and PHP 8.2

Installation

  1. Get googlesitemap.zipΔ, unzip googlesitemap.php and googlesitemap folder into your pmwiki/cookbook directory.
  2. Add to local/config.php such a line:
    include_once("$FarmD/cookbook/googlesitemap.php");

Usage

  • Simply add the script as above. The action is automatic.
  • The lastmod tags will be produced automatically from how lost since modified to either yearly, monthly, weekly or daily - which ever is most relevantcalculated from the difference between last edit date and today.
  • The priority tag defaults to 0.8 for all pages but can be edited by ?action=attr. In the package, Site.HomePage is set to 10.0, Main.WikiSandbox is set to 0.3, Main.SiteMap is set to 1.0. These may all be altered as above.
  • By adding the line $SitemapMaxSaves = 00; you may determine how many page edits will be made befoe the sitemap is auto created.
  • By adding the line $SitemapAuto = 1; the auto create / refresh sequence is enabled.
  • A typical entry in config.php could be:
$SitemapAuto = 1;
$SitemapMaxSaves = 50;
include_once("$FarmD/cookbook/googlesitemap.php");

Future

  • The lastmod tags will be produced automatically from how lost since modified to either monthly or weekly - which ever is most relevant.
  • I will be adding the facility in the near future to use something like notify to regenerate the map after so many edits. (Idea was Petko's and a good one!)
  • I will also be adding a priority tag for each page [0 (least relevent) - much higher number (much more relevent) I suggest pages such as Wiki Sandbox being about 0.3 and Group pages around 10 - up to you!

Change log / Release notes

  • 20231019: First release
  • 20231021: minor corrections, addition of auto select between weekly and monthly for frequency tag.
  • 20231026: re-issue with full functionality as above.

See also

Contributors

Recipe written and maintained by DaveCooke. With support and guidance from Petko

Comments

See discussion at GoogleSiteMap-Talk

FAQ

User notes : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.