How I publish my website (Zim and Rsync)

Created Monday 06 April 2015

There are quite a few options out there on how to publish a website, and pretty much all of them are overly complicated; especially when you just want a simple hierarchical site, easily editable with text. For this site, I simply use two tools:

Zim - which is a sort of "desktop wiki," a simple notebook application that lets you create notes, documents and links. It's something of a digital moleskine; and is a pretty solid replacement for something complex like Evernote. It stores your stuff in a ridiculously simple file-folder format, meaning that you can go through your stuff without the Zim program; you could just use a File Explorer and text editor.

Additionally, it can convert a notebook into HTML+CSS, making it instantly ready for the web. This is now primarily what I use it for. In fact, literally using it now for this. How meta.

Next, is getting it uploaded to the web. Honestly, you could do this easily with an FTP or other file transfer program; just copy and paste the files to your web server.

But, (as I'll discuss somewhere else) one of the big draws of using something like Zim is being able to edit the entire website (not just, say, individual entries) easily and frequently, so I want a simple update command. For this, I use rsync. As its name implies, its used to keep two folders synchronized. In this case, it's the local output of my Zim program and the remote website.

Like a lot of things Linux, there can be subtle differences between two programs that seem the same; the default "copying" program for linux is one called "cp," which I'm not using here. The more subtle reason is that cp is for copying and rsync is for syncing. What's the difference? "cp" is for making a copy that someone else can use, "rsync" is more for literal backup. As a result, rsync is frequently faster. Why? Because rsync doesn't re-copy the whole folder, it only copies "changes."

Like all file things in linux, you have to watch your permissions — this is especially true when trying to upload to the web; Files that live on the web frequently need different permissions so that everyone can see them. After a little frustration, it took me a while to figure out the correct flags for updating my site, which are (obvious fake path names ahead)

rsync -ri /home/my/outputted/html /remote/publichtml/

You may want to alias this.



Backlinks: Tech Guides Home:Miscellany:Staging-LIS5362