Ein Baum und seine Abenteuer

Running a blog in China

Reader of my adventures in China beware! This post is in English and will get technical. You have been warned.

Turns out running a blog in China is not the easiest thing. Well actually running a blog in itself is quite some work but that is a different topic.

My blogs history

After moving through several "blogging providers", you know trying out Tumblr and Blogger and others. I never really kept a blog. But then I wanted to make a site for multiple little projects that I was doing at the time and decided to put them all together with a little blog. That seemed like enough content to keep it going. As I said running a blog is work and hard. And I like to not work. But back to story time: So I set up a wordpress blog. And what did that get me? An email about every other week telling me to update some security flaw in the System. With me releasing posts only once a month or so at best that was a sorry state. So I switched to Hexo.

While Wordpress dynamically generates pages from information in a database Hexo takes in Markdown files and generates static HTML. The advantage being that static HTML files do not have security risks with them as they do not expose any database or similar thing.

Working with Hexo

Being a webdev I wanted to make the generated files better. So obviously they should go through some automated post-processing which should also upload them via FTP to my server and all that with one command. Easy enough. Just get a few gulp tasks running and a simple gulp all would get the new version online. Very nice.

//Minify the generated HTML.
gulp.task('html', function () {
    .pipe(htmlmin({ collapseWhitespace: true }))

You can have a look at the entire gulpfile I use in this gist.

Moving to China

Since coming to China however I have been facing multiple issues with this approach. One is that static file generation and optimization afterwards make sure that absolutely all files change. And all changed files need to be uploaded. So not only does every blog post and every index page have to be uploaded (as they are all just static html) but also every image. That can get to a lot of things to upload quite quickly. Or at least if you are sitting in a dorm with not enough Internet for way to many students.

And then of cause connecting all the way to Germany with sometimes having a firewall in the mix doesn't help either. In fact I even got tons of disconnects while the FTP upload was working when I tried it at work. And work has better Internet (that HongKong Internet).

Chinas great wall didn't cause me trouble but the great firewall did.
Chinas great wall didn't cause me trouble but the great firewall did.

So while the questions of many people back home as to why a certain post was not there certainly made me happy about how many people are actually reading my blog. It also made the situation annoy me that much more.

GitLab to the rescue

There is an obvious solution to part of my problem. While I can't really solve the fact all file change and my readers browsers will think they need to download the header again every time I make a new post. I can at least make the upload and my life easier. Using git. Because that works perfectly and is never blocked. For a few weeks actually I was toying with the idea to set up a script on my server that would pull the up-to-date version from a git and compile it. That way I would only need to upload to a git and the rest would be on a remote server, not a problem.

But that would have been some work involved and I would need a server.

Lucky me though, GitLab announce GitLab Pages which is basically the same thing as GitHubs pages. With the difference that they support Hexo while GitHub only supports Jekll (or however that Ruby gem is spelled).

New workflow

So now I still write my blog the same as before and run a hexo serve locally to check the result. But after that I simply make a commit and GitLab runns a task on their server to generate the blog. I had to use my username subdomain for this because else Hexo had some trouble with finding its resources (which I am sure one could fix given an hour). But that way all I had to do was point my domain to a different IP and set up my project on GitLab to use it.

//Now GitLabs CI runs the scripts for me on their server.
- npm install -g gulp
- npm install
- gulp hexo
- gulp

GitLab has an article on how to get started using their pages as well as a demo Hexo project. I still use the same gulpfile as before only that now GitLabs CI is running it for me. Have a gist with all the config files.

Super simple to set up and run, work like a charme even from China.



I am a JavaScript Enthusiast and developer for the fun of it!
Here I write about webdev, technology, personal thoughts and anything I finds interesting.

More about me

Read next

Deploy a hexo blog from Github using Travis

Read on ūüėČ
Read on ūüėČ

Straightening a lot of things out at the moment I got stuck with my blog.

This should be about the fourth blog I have run in my life. And so far the longest standing one. Mainly thanks to my stay in China. And it has gone through multiple stops so far.

First it was a wordpress powered blog hosted on my webspace at der-gr√ľne-baum.net. That rapidly turned into a maintenance nightmare of "Wordpress needs a security update". So in September of 2015 I took a look around for alternatives and found Hexo. A Node based static blog generator. Technology wise totally my thing and static means pure HTML files without so much security stuff going on. So I switched to Hexo at first uploading by hand via FTP. Last year while I stayed in China the manual upload didn't work so great anymore. The connection just didn't take it. So I moved my blog to GitLab. They had native support for Hexo based sites. I never managed to get the domain moved to there however. So now in 2017 I set out to go for the new domain hoverbaum.net and have it there.

Ein Baum in China: Vorbereitung

Es folgt ein l√§ngerer Beitrag dar√ľber, wie ich mich in den letzten 17 Monaten mehr oder weniger geplant auf meine Reise nach China vorbereitet habe.


Als erstes habe ich mich an der Volkshochschule f√ľr einen Chinesischkurs angemeldet. Dass ich als Uni-Student auch an dem Kurs an der FH h√§tte teilnehmen k√∂nnen, habe ich leider erst jetzt erfahren, dazu sp√§ter mehr. Ich war auch sofort begeistert, die Sprache erinnert ein bissel. an Joda vom Satzbau her und hatte mich sp√§testens da √ľberzeugt. Es ist halt super einfach auf Dinge zu antworten, wenn ich zustimmen will wiederhole ich ohne Fragepartikel, wenn ich wiedersprechen will baue ich ein nein ein. Einzig an die T√∂ne muss man sich gew√∂hnen, es gibt ihrer vier. Den hohen, den aufsteigenden, den abfallenden-aufsteigenden und den abfallenden Ton, nummeriert von eins bis vier. Wenn es darum geht, Dingen Namen zu geben sind die Chinesen so wie so praktischer Natur, so hei√üen die Tage schlicht Tag 1-7.

Generative AI is here to stay!

"A path into the AI future" - generated using Midjourney
"A path into the AI future" - generated using Midjourney

Some reflections on what 2022 showed us about the future.

Generative AI describes AI that takes a prompt and generates something from it. Prime examples include Copilot which takes code or comments as a prompt to complete the code I want to write, ChatGPT which takes a chat message and replies with a human-like answer and Stable-Diffusion (or Dall-E, or Midjourney) which takes a prompt and returns a fitting image. All of these AIs made massive progress in 2022!