Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

ExportHTML

Summary: Export PmWiki pages as "static" HTML pages
Version: 2007-01-12
Prerequisites: any
Status:
Maintainer: Pm

Questions answered by this recipe

  • Can I convert PmWiki pages into static HTML?
  • Can I export my site to a set of static HTML pages?

Description

PmWiki does not come with a built-in export to HTML feature, but other tools can be used to grab a "static" copy of PmWiki pages. Here's at least two options.

1. Export using wget

The following wget(1) command will grab all of the pages from a site, fixing up links to be relative as needed.

    wget -r -k -np -p -l 0 http://example.org/wiki

If running with $EnablePathInfo set, then it's possible to get just a single wikigroup using

    wget -r -k -np -p -l 0 http://example.org/wiki/SomeGroup

Here's the meaning of the options to wget:

    -r    Recursive retrieval.  Wget will follow any links it finds in
          the document

    -k    Link adjustment.  After retrieving the pages, wget will convert
          all of the downloaded files to have relative links instead
          of absolute ones.

    -np   No parent.  Wget will restrict itself to the path
          given on the command line (in the above case, it would
          only download the pages of SomeGroup).

    -p    Prerequisites.  Wget will retrieve local copies of any .css
          files or gif images needed to display the static copy of the
          page locally.

    -l 0  Infinite follow.  Wget will follow all of the links it encounters
          (subject to the -np restriction above), so that it will completely
          spider the group.

Notes

If you want the retrieved pages to have .html extensions automatically added to them, see the HtmlUrls recipe.

How can I login using AuthUser and wget?

PmWiki doesn't use HTTP Basic authentication (i.e., wget --http-user and --http-passwd), but expects the data to be provided via POST requests. Try
--post-data=authid=USER&authpw=PASSWD

Comments

  • 18-Mar-2007 Olivier Bilodeau - I'm using CleanUrls (the ones that wraps around index.php) and this cookbook didn't work. After a little bit of research, I've found a workaround. You just need to create a local index.php directory where your pmwiki wraps around index.php. No more wget errors.

2. Integrated Export Tool

The following tool allows you to export your PmWiki into static HTML files and push them using FTP, SCP, or plain file copying.

For example exported website, see: http://www.physics.ox.ac.uk/users/santoso

Dependencies:

  • Windows (tested with WinXP) - should work in other OSs with minor tweak (see export.php)
  • wget.exe(approve links)
  • For SCP need pscp.exe (tested with 0.59.0.0)
  • For FTP need nftpput.exe(approve links) (tested with 3.2.0.11)

Installation:

  • Download and unzip pmwiki_export.zipΔ
  • Copy export.php in the same folder as pmwiki.php
  • Copy exportConfig.php in the pmwiki 'local' folder for security purpose
  • Download and copy the necessary binary files (see dependencies) to your webserver local drive
  • Tweak exportConfig.php to suit your need.

See Also

Contributors

Edit - History - Print - Recent Changes - Search
Page last modified on June 06, 2008, at 02:36 AM