Web development on a phone with Hugo and Termux
Hugo is an excellent static site generator and website framework.
You can build a static web site using your phone by running Hugo on LineageOS under Termux.
Here’s how:
(The instructions below have been tested with LineageOS 15.1 and Termux 0.64.)
-
Install Go (substitute .bashrc with .zshrc if you use zsh):
# Install go. pkg install golang # Update your shell configuration. echo "export GOPATH=$HOME/go\nexport PATH=$PATH:$GOROOT/bin:$GOPATH/bin" >> ~/.bashrc # Reload your shell configuration. source ~/.bashrc
-
Compile Hugo from source:1
# Install Mage (a build tool for go). go get github.com/magefile/mage # Retrieve, compile, and install Hugo. go get -d github.com/gohugoio/hugo cd ${GOPATH:-$HOME/go}/src/github.com/gohugoio/hugo env DEPNOLOCK=1 mage vendor mage install
That’s it!
You should now have a working Hugo setup. Enjoy web development from your phone and, if you want an easy way to deploy from your phone and/or to join the peer web, check out my other posts on Web+2.
Written on my LineageOS phone using Termux, Emacs and Hugo. Deployed via rsync and available on the peer web at dat://ar.al/2018/07/30/compiling-hugo-for-mobile-phones-under-termux/. To view peer web sites, use Beaker Browser.
-
The official Hugo compilation instructions hang under Termux at the
mage vendor
command. The instructions here differ from those by setting an environment variable that avoids the hang. ↩︎ -
Web+ and Web+ on a phone ↩︎