How to retire a Wordpress blog (make Wordpress a static site)

Dear LazyWeb, I’d like to see two Wordpress plugins: one to retire a Wordpress weblog (i.e. generate a static copy of the site, add a “blog retired” note on all pages, and close commenting), and one to export the site, rich text, images, comments and all. The export would mainly be to extract a copy into one document, like a PDF.

Despite the prevalence of guides on going the opposite direction, I’m not the only one thinking about converting a Wordpress blog into a static site. As for the one-document export, I have a quick and dirty solution, which I’ll be posting soon.

As for creating a static copy of a blog, one way to go would be to use a spider tool. I haven’t actually used any of the “grab a whole site with one click” tools, so there may be easier ways, but one great utility is wget.

It’s available on all platforms, and it has tons of nifty options. Here’s a quick run-down of options you may need to grab a Wordpress site. As always, the wget MAN page has all the details.

Why retire?

Why does a Wordpress blog need to be retired? Well, for one, it’ll lessen the strain on your database and speed up the site.

The main reason is that every once in a while, a vulnerability is found in WP, and keeping a bunch of old installations up to date is a hassle.

Create a “retired” theme

I suggest you make a copy of your current theme and do at least the following changes:

  • remove the XML-RPC API link from the header
  • add a note to the header that the weblog is no longer being updated
  • disable commenting and trackbacks

Now, wget it

wget -r -E -T 2 -np -R xmlrpc.php,trackback -k http://[BLOG URL]

I’ll briefly explain the options:

-r
recurse through the sub-directories
-nH
don’t include the host name in the downloaded directory
-T INT
how many times an URL will be tried; this is good to set, as xmlrpc.php will fail
-np
don’t include parent directories
-k
convert links to work with downloaded site
-E
adds .html extension to application/xhtml+xml or text/html content types without .html extensions
-R PATTERN1,PATTERN2,…
reject file suffixes or patterns
-X DIR1,DIR2,…
exclude directories, may contain wild cards

I’ve excluded the xmlrpc.php and trackback files as they are redundant in a static site.

Disable Wordpress

Finally, disable Wordpress. This was the whole reason to retire the site, right?

---


  • Home
  • About
  • Preferences