lodestone.life

How I deploy my blog with Hugo and Obsidian

This is a bit more clunky than others I’ve seen online, but for me, it’s the easiest and quickest way I’ve found.

In my Obsidian vault, I have a blog folder containing a folder for my own notes and a separate content which is copied directly from Hugo. I then use rsync to move it to my remote machine and then rsync again to move it from the remote machine to a public facing web server.

More specifically, I use rsync -az --delete "/local/obsidian/blog/content/path" "/remote-dev/hugo/content/path" to sync new posts to the dev machine with Hugo installed. On the dev machine, I have a script that runs cd /remote-dev/path/to/hugo && hugo then rsync -az --delete "/remote-dev/path/to/hugo/content" "/var/www/html" To do all this in one go, I can run a script on my local machine:

#!/bin/bash

rsync -az --delete "/local/obsidian/blog/content/path" "remote-dev:~/hugo/content/path"
ssh remote-dev "cd ~/hugo && ./deploy.sh"