Phone Hugo

Dave Naylor

| 3 minutes

Categories: Blogging

 Phone Hugo

Content creation on a phone because why not?

That camera-phone photo at the top of this page was taken, by me, from a bar at Buda Castle in Budapest; I was on a stag weekend with a bunch of mates. On the last day a mate of mine Phil, the undisputed King of Pop, and I, went on a meandering tour of Budapest, ending up at Buda Castle, via a funicular.

The river is the not-so-blue-at-the-time Danube and the impressive building in the distance is the Hungarian parliament. I reckon it looks like it was designed by Disney. Phil and I sat gazing out over the Danube, serenaded by a guy playing the Blue Danube on a clarinet. It was in fact awesome.

The whole scene matched a daydream of mine where I’d be seated at a similar location, sipping a glass of wine whilst working on some code using a laptop or other mobile device. The daydream will probably remain a fantasy but nevertheless I want the ability to write on the hoof.

Hugo to go

Since this website is now created using Hugo, any new content has to be statically generated and then deployed to a hosting environment. I could make use of a third party service such as Forestry, but I like to eat my own dog food, so I host this site at Linode.

The site’s code and generated HTML pages are pushed to a GitLab remote git repository (repo) but I made the decision to keep images and other hefty files out of version control. I didn’t want to clutter-up the repo and slow down deployments, therefore I have entries for jpgs and pngs in my .gitignore file. I can add more filetypes easily if required.


Obviously, I have to push images from Hugo’s public directory tree to the web server so I use good old rsync in an image deploy script:

rsync -avO -m --include-from='./.includefile' --include='*/' --exclude='*' public/ <my-server:/path/to/web/dir>

The .includefile just lists the filetypes I want to sync with the server, everything else is ignored by rsync. It’s pretty much identical to the .gitignore file.


A git push to the repo triggers a DeployHQ deployment of everything intended for public consumption apart from those image files. I then run the rsync script and the words are joined quickly by the images.

Yep, I could rsync everything and cut DeployHQ out of the loop but this way I force myself to commit changes to the remote repo, just to be on the safe side.

The phone bit

To update things away from my desk I need a way to connect with GitLab using my android phone together with tools to write code, edit posts and manipulate images taken with my phone’s camera.

I have Termux installed on my phone which is described as:

…an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager.

I get Vim, Git, Rsync and Hugo installed as packages within the Termux installation thereby mirroring my desktop setup. Smashing.

I use Vim for a lot of work but I’ve also installed Markor, a markdown editor. I can expose aspects of the android filesystem, such as Termux, to Markor meaning I can edit my website in that too.

The only bit missing is an image editor and for that purpose I use Photo Editor, because it rocks.

It’s a tiny bit of faff but the setup is simply a case of running the Hugo command once I’ve written a new post, then push to GitLab, then run the image deploy script. Bish, bash, bosh. Easy really.

I spent some time playing with git’s large file system (git-lfs) but seriously, my little rsync setup is way less faffy.


Previous post

Summer Solstace