[wp-hackers] Importing HTML files as pages -- been done?

Harish Narayanan harish.mlists at gmail.com
Sat Feb 7 08:18:51 GMT 2009


MLA wrote:
> I have the opposite problem and can't find a solution. I need to convert
> a WP site to static HTML pages. In case anyone is wondering why, it's a
> local govt site for a now defunct organisation that will never be
> updated again but has to be kept alive for three years (legal/archive
> reasons). Removing WP would reduce maintenance to almost zero. I could
> sit and manually save and clean up 600+ pages  but it would take longer
> than the current maintenance time. No amount of searching has so far
> come up with a usable solution but if anyone knows of a way I'd be
> eternally (well, three years) grateful.

Here's a sequence of steps that works for me, but for an entirely
different purpose[1].

1. Install wp-super-cache.
(http://wordpress.org/extend/plugins/wp-super-cache/)

2. Write a script to make sure all your pages are crawled. This ensures
that wp-super-cache at least generates all pages once and stores them
statically.

   In order to do this, I've:

    a. Installed the XML sitemap generator plugin.
(http://wordpress.org/extend/plugins/google-sitemap-generator/)
    b. Fetch its output, say listing.xml, and create a bash script to
pull all the files:
    grep '<loc>' listing.xml | sed 's/<loc>/ wget --delete-after /' |
sed 's/<\/loc>//' > listing.sh
    c. Run this script using 'bash ./listing.sh'

3. Save the cache folder created on your server.
   ($WP_HOME/wp-content/cache/supercache/yoursite.local.gov/)
   This preserves your website exactly the way it is, including link
structure.

Harish

[1] I use it to make WordPress behave like an engine that generates
static HTML on inexpensive servers where the MySQL connection is
sometimes overloaded and hence slow/flaky.


More information about the wp-hackers mailing list