A motor with a lot of cogs, wheels and bands.

Usually this blog does not focus on technical details. Until I figure out a better way to share it, this is an exception. I wanted to share my setup, in case it helps someone else. If I left out the detail you needed, feel free to contact me.

Development

This blog is created with Jekyll. For development I use Docker and docker-compose.

The docker-compose.yml

---
services:
    jekyll:
      image: bretfisher/jekyll-serve
      volumes:
        - .:/site
      ports:
        - '4000:4000'

That way I can work on any machine that has git and Docker (with docker-compose). The project has a readme.md where I store everything I have to remember, including ToDos. The exclude list in _config.yml is used to make sure convenience files are not included in the final site. That gives me freedom to add what I need.

Migration

I used the RSS-feed and a ruby script to do a rough migration of my texts. Since the old platform did not support a feed containing all posts, I had to do some un-publishing to make it work.

Editor

I prefer to use RubyMine for writing blog posts and have created custom templates for the collections I create most often. How to create custom templates.

Deployment

The site is run on Ubuntu with nginx. Updates are made by GitHub actions. The deploy-action is based on an ssh-action. It logs in to the server, pulls the latest version from git, builds the site on the server and copies it to the right folder. I like how GitHub actions are stored with the source code. Since I can push to git over 443, I can also deploy from places with very strict firewalls.

Analytics

The site uses Matomo. Currently I use their SaaS, but it is easy to host on your own. I have disabled all cookies for tracking. That gives me less data, but probably enough data. If I change my mind you will see the banner.

Images

For images I use a Jekyll _data-file and an include. The illustrations.yml has a path to the image file, the alt-tag text, and credits (often including copyright information.) Illustrations also have a name, used as an id. This way I can make sure that all images have the meta data needed.

My image.html in _includes. The {% assign ill ... line finds the illustration based on name.


{% if include.image %}
    {% assign ill = site.data.illustrations[include.image] %}
        <img src="/assets/images/{{ill.assets-path}}" alt="{{ ill.alt }}" title="{{ill.cred}}"/>
{% endif%}

In the layout files it looks like this:


  {% include image.html image=post.illustration %}

where post.illustration is the name of the illustration.

To get the image to preview in social media I use _includes/head.html


  {% if page.illustration %}
    {% assign ill = site.data.illustrations[page.illustration] %}
    <meta property="og:image" content="{{ site.url }}/assets/{{ ill.assets-path }}" />
  {% endif %}

There are Jekyll plugins for images, but I did not think that they fit my needs. I might change my mind later.

Comments

I have not had many comments on my previous setup, so I opted for a low-tech “e-mail me” version. The link tag pre-populates the to-address and what post the comment refers to is included in the subject. If there are loads of comments I will need another solution, but that is a nice problem to have.

This text was last modified 2024-02-16

Related texts

A single frosted leaf with clear contours and veins.

TDD in the context of writing code to be read

Wunder Baum hanging from a car window (Known as Little Trees in most English-speaking countries)

Wunderbaum testing