jorge build

Prepare for production

So far you’ve seen how to start a project, serve it locally and add some content to it. The last step is to prepare your site for the public, and jorge build will help you with that:

$ jorge build
skipping draft target/blog/my-own-blog-post.org
wrote target/2024-02-23-another-kind-of-post.html
wrote target/blog/my-own-blog-post.html
wrote target/blog/goodbye-markdown.html
wrote target/assets/css/main.css
wrote target/blog/hello-org.html
wrote target/blog/tags.html
wrote target/index.html
wrote target/feed.xml
wrote target/blog/index.html

Just like jorge serve did before, jorge build scans your src/ directory and renders its files into target/, but with a few differences:

After running jorge build, the contents of the target/ directory will be ready for a web server. There are many ways to publish a static site to the internet, and covering them all is out of the scope of this tutorial1. I suggest going through the Jekyll and Hugo docs for inspiration.

But for the sake of completeness, this is how this site is deployed: I have a VPS box running Debian Linux and with the nginx server installed on it. I added this configuration to /etc/nginx/sites-enabled/jorge:

  server {
          charset utf-8;
          root /var/www/jorge;
          server_name jorge.olano.dev;

          location / {
              # First attempt to serve request as file,
              # then as directory. Otherwise respond 404.
              try_files $uri $uri.html $uri/ =404;
          }
  }

I instructed my DNS server to point jorge.olano.dev to the IP of the box and I ran certbot to generate certificates for that subdomain. I then created the /var/www/jorge directory in the server, and deployed from my laptop using rsync:

$ jorge build
$ rsync -vPrz --delete target/ root@olano.dev:/var/www/jorge

And that’s it!

Notes


1

PRs welcome!