Categories
WordPress

Creating a Static Web-site from a WordPress Blog

I have an old WordPress Blog that I created circa 2005, which is no longer updated. In order to remove the need to (constantly) update the version of WordPress, themes, plugins etc. and to create a version suitable for archival purposes, I decided to convert the blog to a Static web-site.

It was difficult to find a suitable WordPress plugin to do the job so I deciced to look for alternative approaches. One way of doing this is to use a software application such as HHTrack, a free (GPL, libre/free software) and easy-to-use offline browser utility, that will create a copy of
a web-site on your local computer.

https://www.httrack.com

It allows you to download a World Wide Web site from the Internet to a local directory, building recursively all directories, getting HTML, images, and other files from the server to your computer. HTTrack arranges the original site’s relative link-structure. Simply open a page of the “mirrored” website in your browser, and you can browse the site from link to link, as if you were viewing it online. HTTrack can also update an existing mirrored site, and resume interrupted downloads. HTTrack is fully configurable, and has an integrated help system.

The existing blog consists of just under 600 posts/pages and has approx 150MB of media files.

Before starting, I backed up the WordPress directory and related MYSQL database on the server.

An initial run of HTTrack successfully created a version of the blog as a static web-site that seemed to work OK and highlighted a number of issues and limitations.

  • Comments do not transfer – This is not a big issue for me, although it should be possible to come up with a suitable work-around for handling these if necessary.

The first thing I did was to check the WordPress plugins being used, removing those that were not relevant for a static website. I also wrote a small plugin to remove/disable the current Responsive Images feature in WordPress.

It was interesting to note a variety of different techniques used for embdedding YouTube videos in the blog pages – this was caused by differing techniques evolving over the time that the blog was written (10 years+) and I decided to ensure they were consistent through the site using the embed code provided from the YouTube site.

I also decided to migrate the blog from HTTP to HTTPS as part of the exercise. The WordPress theme being used has some hard-coded urls using HTTP so I edited these to use HTTPS.

I then ran the HTTrack utility to create a local copy of the blog, in fact I ran the utility a number of times checking and tweaking details in the blog between each run. The utility provides a helpful log of warning/error messages that occur during the run

Final steps included mass-file editing of the local files to convert HTTP references to HTTPS and other clean-up operations on the final files.

I also created a zipped up copy of the original blog files and MYSQL database, which have now been archived, in case I ever need to return to the original blog.

1 item not addressed during this process was how to handle referenced URLs which have expired. An expired URL is one which is no longer valid because the original destination has changed or disappeared completely. I have a few ideas how to handle this phenomenon if I can ever find the time to explore it further.

Other Links

http://redirectdetective.com/creating-redirects.html

Categories
Techniques Tools WordPress

Archiving a WordPress Blog

As part of my annual spring-clean, I decided to archive some of my old WordPress blogs which I no longer update and will give up the related domains.

There are a number of different ways in which you can archive the blog, for example, you can simply dump the blog database, export the blog posts and save all the media files you may have used with the blog. This allows you to regenerate the blog if you so decide in the future,

Another alternative, is to simply save all the articles in a pdf file or multiple pdf files – an easy way to do this, in the Chrome browser is using the “RMB … Print option on the page you want archive and select the “Save as PDF” option. If you want to save the whole blog in this way, simply ensure that all the posts/articles are currently being displayed when you print the page. (This may not be practicable for blogs with a lot of posts)

While thinking about the different possibilities, I toyed with the idea of converting the blog into a linked set of static HTML files and discovered the really-static plugin for WordPress.

http://wordpress.org/extend/plugins/really-static/

The really-static plugin will generate a static, HTML version of a WordPress blog. In addition, it will make  changes automatically to the static version of the blog when a post is published, edited or deleted.

In my case, I only want to generate a static HTML version of the blog, but because of the possible performance improvements in serving static HTML pages over the usual generation mechanism, I may use it in conjunction with my live blogs too.

Categories
WordPress

How to disable the Admin Bar in WordPress

If the WordPress Admin Bar is getting in the way when you’re logged in to your blog and viewing your website you can disable it by modifying a setting in your user profile.

Simply select or un-select the option as required.

Categories
Hints/Tips WordPress

Closing Comments on Old Posts in WP

In WordPress, it’s possible to turn comments off automatically after a specified number of days have elapsed.

Go to the Settings … Discussion page.

In the Other comment settings section, select the  option Automatically close comments on articles older than __ days.

Fill in the number of days, and save.

Categories
WordPress

Code Highlighting

I want to use a code highlighting plugin for WordPress and I’ve started using the SyntaxHighlighter Evolved plugin which is based on the Syntax Highlighter Script.

Code can simply be enclosed within shortcodes of the required language.

Thus, including the following code

[code lang=”php”]
<?php
phpinfo();
?>
[/code]

gives the following result

<?php
phpinfo();
?>