[pmwiki-users] Static 'site maps'?

Patrick R. Michaud pmichaud at pobox.com
Sun Jan 2 14:42:59 CST 2011

On Sun, Jan 02, 2011 at 01:45:10PM -0500, Ben Wilson wrote:
> I believe the Pagelist updates every time there's a page save, not on
> every page view. Are you saying there's page generation apart from the
> wiki engine itself?

In PmWiki, a page save invalidates the current pagelist caches
but does not immediately update them.  The caches are then
rebuilt as-needed in response to pagelist requests.

A page save will update the pageindex for the page being saved.
The index also gets rebuilt in response to pagelist requests
as needed.  If rebuilding the page index takes longer than
10 seconds (configured by $PageIndexTime), PmWiki postpones
further building of the index until a subsequent request
so that the current request isn't starved for too long.

In other words, the site doesn't pay any cost for indexing
or caching pagelists until an index and/or cache is needed 
based on a request.  The index and cache are then re-used for all
subsequent requests until something occurs to invalid them
(such as a page save).

Here's how I would approach creating a "static" Google SiteMap:

Internally, PmWiki maintains a $LastModTime variable that
indicates the last time anything was modified on the site
(e.g., a page, configuration file, cookbook recipe, etc.).

A SiteMap recipe should maintain a file somewhere containing 
the current sitemap.  Whenever a request comes in for the 
sitemap, the recipe compares the timestamp of that file against
$LastModTime, and if $LastModTime is greater, regenerate
the file (using PmWiki's built-in PageList functions).
Then, return the current contents of the file (either freshly
regenerated or left-over from the previous sitemap request).

Note that Google also accepts RSS and Atom feeds as sitemaps [1],
so another possibility is to configure PmWiki for RSS/Atom
feeds and submit a Site.AllRecentChanges feed to Google.

(And if I were to add Google SiteMaps capability to PmWiki
itself, I'd probably start by extending the feeds.php script
to produce the needed XML, since it already knows how to
create XML documents from pagelists.  It might also be
worth adding cache capabilities to feeds.php.)

[1] http://www.google.com/support/webmasters/bin/answer.py?answer=183668


More information about the pmwiki-users mailing list