Converting from Blosxom to Flatpress

Sunday, 29 September, 2019

This blog has been offline for a little while as the original Blosxom implementation had been hacked. Blosxom was a wonderful CGI script that was elegant in its simplicity yet eminently extensible through the many plugins which existed and made it moderately feature rich. Best of all, it used plain text files to store all its entries which makes backup and conversion much simpler than a database. With my implementation of blosxom decommissioned, I needed to find a replacement. Google flat file blogging engines and there are a lot. However many of the projects have been orphaned, like blosxom, and no longer in active development. What I wanted to find was an engine that was simple, had some good features and an active community. Flatpress seems to fit the bill with a new maintainer - and active Flatpresser - Arvid Zimmerman.

The next step was to convert my archive of over 1000 blosxom blog entries to Flatpress. Big shout out to James O’Connor who wrote the Python script to convert the files. The process is broadly this:

  • download your Blosxom files, including all the sub-directories for categories, but make sure to maintain the date/time filestamp of individual files - this is used to timestamp the entry for Flatpress. WinSCP does this (Filezilla doesnt)
  • make sure the categories only ONE DIRECTORY DEEP. Move any sub-sub-directories up to the top level
  • rename all the directories to numbers. These are used to tag the entries and can then be recreated within FlatPress
  • copy the script.py and template files to the directory the folders are stored in
  • edit the template file to have the header/footer you want. The content, date and categories will be changed for the entries
  • run the script
  • a new fp-content directory will be created with all your entries
  • upload this to your flatpress site and rebuild the index

The script does the following

  • renames the file to entry‹date›-‹time›.txt based upon the date modified date
  • copies the file to a new subfolder in FlatPress /content folder based upon year and month
  • deletes the first line from the file (and deletes the first line break)
  • prefixes the file with:
    VERSION|fp-1.1|SUBJECT||CONTENT|
  • suffixes with:
    |AUTHOR|miksmith|DATE|<1566926569>|CATEGORIES||

Any updates will be posted over at Flatpress.