Skip to main content
blog.chobble.com

Adding social preview images to my Eleventy blog

I just followed this excellent guide by Matthew Paul to add social media preview images to this blog - and it worked great!

Here is the commit which did it - I tweaked Mat's guide a bit because my blog is set up with ESM rather than CommonJS - hopefully if you're also using an ESM setup then you can find some inspiration here.

Because this blog is built by nix-build I also needed to tweak things a little to add the ubuntu font to the site's default.nix and to use that font inside social-preview.njk - without that, no fonts were accessible and the text rendered as tiny squares.

My blog is based on this template: https://github.com/11ty/eleventy-base-blog

Here's the final image for this post:

'Social media preview images' blog post preview image

Very satisfying!