Write Hugo posts from a phone/tablet on the go

Tue Jun 29, 2021 - 630 Words

So I’ve been looking at how to write posts on the go in Hugo. My setup is having a Nextcloud folder with the Hugo binary and the entire website alongside. This means I’ve have version control on all the files, courtesy of Nextcloud and have a version of Hugo I know works with my structure. I’ve never experience Hugo making breaking changes when upgrading, but on the off change it did, I will be able to continue updating my site until I was ready to implement changes required for new version of Hugo. For at static site generator the security implications of running an outdated Hugo version is in my opinion nonexistent. But always look at the changelog,there might be new features you are missing in your current build. Having everything in one folder really is a killer feature, it means you are always able to work on the site, from any computer, anywhere in the world.

This is how my homepage folder structure looks like:

├── archetypes
│   └── default.md
├── content
│   ├── _index.md
│   └── posts
│       ├── cancer
│       │   ├── _index.md
│       │   ├── knowing-its-unknown
│       │   │   ├── aauh-syd-gastro.jpg
│       │   │   └── index.md
│       │   ├── new-start.md
│       │   └── warning-signs-are-setting-in.md
│       ├── tips-and-tricks
│       │   ├── hello-hugo.md
│       │   ├── Hugo-content-from-tablet.md
│       │   └── _index.md
│       └── vanlife
│           ├── _index.md
│           └── life-on-the-road.md
├── data
├── hugo
├── hugo.toml
├── layouts
├── public
├── resources
├── static
│   └── files
│       ├── BAIT2.pdf
│       ├── BAIT3-6_studieordning_sep-09.pdf
│       ├── BAIT3.pdf
│       ├── BAIT4.pdf
│       ├── BAIT5.pdf
│       ├── BAIT6T.pdf
│       ├── BAIT-INF1-2_studieordning_aug-09.pdf
│       ├── INF1-6_studieordning_sep-11.pdf
│       ├── INF5.pdf
│       └── INF7-10_studieordning_jul-12.pdf
└── themes
    └── minimalt
        ├── archetypes
        │   └── default.md
        ├── layouts
        │   ├── 404.html
        │   ├── _default
        │   │   ├── baseof.html
        │   │   ├── list.html
        │   │   ├── single.html
        │   │   └── terms.html
        │   ├── index.html
        │   ├── partials
        │   │   ├── footer.html
        │   │   ├── header.html
        │   │   └── head.html
        │   ├── posts
        │   │   ├── list.html
        │   │   └── single.html
        │   └── term
        │       └── list.html
        ├── LICENSE
        ├── static
        │   ├── css
        │   │   ├── style.css
        │   │   └── style-old.css
        │   ├── images
        │   │   ├── front-bg.jpeg
        │   │   ├── front-bg-light.jpeg
        │   │   └── my-bg.jpeg
        │   └── js
        └── theme.toml

On my mobile and tablet I have installed the Nextcloud client (Fdroid Built | Googleplay Build). In the app i can navigate to the folder and use the menu to sync the folder. Here is a screenshot of it looks on my andriod phone… Nextcloud on Andriod folder sync

Next I’ve installed a Markdown editor for Android, I went with Markor. It’s opensource and available on F-Driod, that’s right up my alley. From within Markar I can find my synced folder, but is has a bit of a weird path. I’ve located my sync folder in:

Android/media/com.nextcloud.client/nextcloud/username@nextcloud.instance/Webpage/Content/Posts

Note: I need to select andriod root storage to find Andriod/Media

However if I edit files or create new files in that folder the nextcloud client will pick up the changes next time i open it and sync or upload. I find this setup pretty neat and really flexible if you are sitting in a train or bus with time to spare and a spotty internet connection.

I build my webpage from my laptop and upload to my homeserver via SSH, this written posts on the go would not get published before my laptop get connection and I push update. I’ve heard of others who run Hugo as a cron job every 5 min. But it all depends on how your hosting your site. For my setup a Cron job will not work as my Nextcloud is encrypted, so files are not directly readable. I also enjoy pushing the “enter” on the big upload command :)