I have now created a basic website for the blog using Hugo. I’ve gone the GitHub/Netlify route so have a local repository on the Raspberry pi which I can then push to GitHub. Netlify then automatically deploys the site. I’ve yet to redirect my domain there and will hold off from doing so while I do further tinkering.

I had wondered how I would go about posting to the site, so I spent some time last weekend fiddling around. I’m happy with what I’ve come up with.

I do the majority of writing for the blog on my phone, using Drafts. So that had to be the starting point. Drafts does not have an SSH option to save files to but it does have WebDAV. This means I can save a file to my Nextcloud server on the pi, so I’ve created an action in Drafts that adds front matter to the post and then saves it with a date based file name to Nextcloud. So far so good.

My Nextcloud files are saved on a USB stick on the pi, and so the next thing is to pull the post file from there into the content folder in the local git repo on the pi. With me so far?

I did this by using rclone to sync the Nextcloud folder where blog posts are saved to the content folder on the pi. I’ve set this up as a cron job which runs every 15mins.

Finally, I wrote a bash script that runs a git pull/add/commit/push action that again, is saved as a cron job and runs at similar intervals to the other one.

As mentioned at the beginning, Netlify does the rest.

Sounds convoluted, but in practice, all I now have to do when I’ve written a post is to run the Drafts action. The rest is automated. So from my end, it’s very low friction, which is what I was aiming for.


Stephen James

Minding the gaps


© Stephen James 2021

Powered by Hugo & Kiss.