(tech)

Obsidian has fascinated me for the last year or so, as a way to organise and relate files. I’m used to using Markdown from software development days, as a way of formatting and organising document text. The combination of Obsidian and Markdown is an elegant way of organising writing, and it is simple to use and maintain. Markdown is just a standard, so it is free, and there is plenty of software that supports it. Obsidian has a free tier that is very rich and powerful, with an established community, and many plugins. (The paid-for tier has web synchronisation of your vault, so that you can access it from multiple devices)

Obsidian uses ordinary files and folders for it’s content, and runs on Windows, Linux, Mac and Android - at least. The content for this site is an Obsidian vault, with the posts written in Markdown text.

Another free tool that runs everywhere is Hugo. It is a very fast static site generator, and it has a strong community that have produced many plugin themes. I’m using the PaperMod theme for this site.

Although everything is accessible to allow additional site code to be added, you get a lot by just adding content in Markdown and plugging in an appropriate theme. So, all I need is a bridge to take the content from my Obsidian vault and put it into a Hugo site with a few tweaks on the way. There is an Obsidian plugin to do that, Hugo Publish. Once the plugin is configured to point to the Hugo folder, the sequence to add a blog or edit content is simply this:

  1. Write or change the blog. Obsidian can show the text in its final format as you type, and has support for inserting links, lists, tags etc. Add a blog tag when it is ready to publish.
  2. Click the Hugo Publish button, and those files that have been tagged as completed blogs, will be added to Hugo.
  3. I can either run hugo server to prepare a local version of the site that can be checked with my browser, or run hugo build to prepare the web version, ready to deploy.

To deploy it, I just need to get the contents of Hugo’s public folder into the htdocs folder on my server. There are many ways to do it, but as well as copying the new content, the former contents need to be removed, and system files on the server should be left untouched . One way that does all that is the following shell script, that uses lftp and is run in the Hugo folder.

#!/bin/bash

# Configuration
HOST="ftp.everyones.earth"
USER="me"
PASS="********"
REMOTE_DIR="htdocs"

# Run the sync
lftp -c "set ftp:ssl-allow no; open -u $USER,$PASS $HOST; \
cd $REMOTE_DIR; \
mirror -R --delete --verbose ./public/ ."

That’s how this got in front of your eyes.