Building this web site

This is a static web site designed to be served from a host like Neocities. By static I simply mean that the server simply serves web pages as they are without processing them at all.

The headers and footers are the same on each page so instead of pasting them in they are included by a clever bit of minimalist Javascript courtesy of Michael Marr, see HTML Includes.

The pages that are not generated automatically are edited in Emacs HTML mode and the whole lot is uploaded by a Python 2 script that uses the Neocities Python API wrapper.

Book Catalogue

The book catalogue is created by exporting from Tellico (see Acknowledgements). At the moment this is done manually from the UI. I presume that I could either hack Tellico to do it on the command line or learn how to apply the XML transforms to do it with xsltproc.

HTML includes

This site runs on Neocities so server side includes are not possible. I also want to edit the HTML directly so templates executed before upload are not all that convenient either. A solution is client side includes and Michael Marr (known as LexmarkWeb on GitHub wrote a tiny script to do just that.

Another convenience is that client side includes means that if I change one of the included files that is the only one that has to be uploaded.

I copied the minified script and added this to the head of my pages:

<script src="csi.min.js"></script>

Then wherever I want another file included I just add a div like this:

<div data-include="some-repetitive-stuff.html"></div>

Scripts

Upload

The upload script is a simple python script that enumerates all the local files and uses the Neocities Python API to upload the new and changed ones and to delete those that are no longer present on the local machine. The original script used hardlinks to detect when the files changed. This works fine for files like the book catalogue that are copied from elsewhere but fails for files Edited by Emacs because I haven't succeeded in persuading it to make back up copies while also using version control; this means that Emacs just writes directly to the file which means that both entries still refer to the same file. The solution is to use touch instead and compare mtimes instead of inode numbers.

Here is the script:


	

Tidy

I occasionally run tidy to clean up the handwritten files, but not before they have been checked in to the local Git repository.