hablo/doc/Deploying-a-hablo-blog.md

2.4 KiB

Deployment

Since hablo generates static blogs, deployment is a fairly easy step. The only detail to pay attention to is the handling of dependencies.

We show here a simple local deployment of your blog assuming you use NGinx but this is fairly easy to transpose to your favourite web server. First let's create an NGinx configuration file for your blog. Let's put the following basic configuration

server {
	server_name blog.turtles.social;
	listen 80;

	root "/path/to/Turtles paradize";
}

into /etc/nginx/sites_available/turtles.conf. Of course, the server_name used here is purely an exemple assuming you bought a domain name for your blog and you pointed it to the very host you're working on. This is in practice highly unlikely; I could've suggested localhost instead of blog.turtles.social but you may have other local virtual hosts configured, I can't know your particular setup. You may have simply added an alias like turtles.local in your /etc/hosts to bypass all DNS resolution. If you have no idea what I'm saying and this is the first time you've configured a virtual host in NGinx, just use localhost.

Enable the site

sudo ln -s ../sites_available/turtles.conf /etc/nginx/sites_enabled

and now reload the nginx server.

sudo nginx -s reload

Now let's install the dependencies.

UnitJS

Hablo requires UnitJS. Go to some temporary work directory, clone it and generate the packed JS module.

cd /tmp
git clone https://git.marvid.fr/Tissevert/UnitJS.git
cd UnitJS
make

It's in dist/unit.js. Let's go back to your blog's directory and copy it.

cd "/path/to/My perfect life is better than yours"
mkdir -p js
cp /tmp/UnitJS/dist/unit.js js

Remarkable

The markdown is converted to HTML in the client browser with the JS library remarkable.

We can simply download it in your js directory.

wget 'https://cdnjs.cloudflare.com/ajax/libs/remarkable/1.7.1/remarkable.min.js' -O js/remarkable.min.js

That's it ! Your blog should now be displayed when you point your web browser to http://blog.turtles.social (or http://turtles.local or http://localhost depending on what you put in your web server's configuration for server_name). You might now want to read about tuning it to your taste.