Foreword

So I have a blog now. See here

It is peacefully lying on my ssd. I can even serve it locally and admire it. Surely, this is not enough, and sooner than later I would want it to be accessible on the WWW.

But first, let's access it from my local network. I would like to know how it looks on the tablet, for whatever reason.

Zola serve

I can easily go to the root folder of my blog and execute zola serve.

Then I can go in my browser to localhost:1111 or 127.0.0.1:1111 and see my site in all its glory and, at this point, vast and impressive emptiness.

Cool, now let's see how it looks on my tablet.

(if you know some basics of networking you probably know where this is going, but I think that it is a good situation that almost always gets discarded, due to some assumptions about some amount of knowledge which was obtained some time ago)

Zola serve with extra bits

I have a tablet in my hands. I know that I have a blog up and running on my PC. I know that my PC and tablet are at the same network. In my case the former is connected through the wifi while the latter uses a wired connection, both served by one router. Perfectly valid to assume that I can easily access my site from the tablet.

But what should I type into my browser, where should I go? Some will try to open localhost on their tablet and be annoyed when this accomplishes nothing.

Some may remember that there are those elusive things called ip-addresses.

They will grab the local ip address of their PC.

From the second or third attempt some will remember to add a port and will end up with url similar to 192.168.0.130:1111.

They will submit the url and their level of annoyance will go through the floors of two to three neighbors peacefully minding their own business in apartments above.

Situation described above totally not related to my own experience.

Disclaimer: I can't say that I'm good at networking, I'm hardly bad at it, but I will try to explain some bits. I encourage you to search for such items as: ip address, localhost, local network, network adapter.

You see, localhost or 127.0.0.1 is called a loopback device, it sort of a fake network adapter that represents local-only interface. It can only be used to communicate within the same host machine. So, even though your PC and tablet are on the same network, you cannot access the blog because it served on localhost and can be accessed only from your PC.

But we can easily rectify the situation.

Just like there is a special address 127.0.0.1, there is a special address 0.0.0.0. When we specify to listen on 0.0.0.0 we basically tell to listen for connections on all available network interfaces.

We can specify it in multitude of ways but I like to use explicit command:

zola serve --interface 0.0.0.0 --port 1111 --base-url http://192.168.0.130

Now I still can access blog from PC through localhost, but also by the ip address and port from any device in my local network.

Appearing on the WWW.

Logical next step would be to make our blog be accessible on the web.

There are many ways you can acheive it. Main ones, at least for me, would be to host it myself, rent a VPS or slap it on the cloud.

Since it is my toy project, at least for now, and I plan to serve only static content, I can see a few basic options, namely:

  • Github pages (I already use a private repo for this project)
  • Cloudflare pages (never used it before, didn't even know about it)

I seem to remember, and it can be a positively false statement, that github pages lacks any sort of analytical tools, and remember, this blog will be a subject to my wife's seo optimisation experiments.

So I have picked Cloudflare pages. You may have already sniffed that my research is always on another level, quite possibly below basement.

For both this and many more options Zola have entries in its documentation.

Cloudflare related instructions were a bit unclear in the end, but nevertheless I managed to brute it through. My solution ended up being as elegant as a fox at chickens party.

All I had to do in the end is to enable web analytics.

And here you are procrastinating through a reading of a random blog from a random block. Beauty of the web.