I previously wrote about my process to publish posts on my blog, but in the meantime I have been quite busy. My workflow has now changed quite a bit.
Before, I had a single script called notion_export.py
living in my blog’s repository that downloaded all posts and their assets and copied them into my _posts
directory. This script ran daily on GitHub Actions and mirrored my entire writings from Notion to my blog.
As I added more features, the script grew in size drastically, which is why I refactored it into a standalone cli: notion-to-jekyll
. The basic structure remained identical, but it’s a cli tool now that can be used for any Jekyll site.
-
Instead of downloading all posts, it only exports those that have changed since it last downloaded them.
-
It logs any changes to Logsnag and notifies me.
-
It supports inline equations that work with Katex, which means I don’t need JavaScript to render them with MathJax on the frontend.
-
It converts all images to
.jpg
and renames them to an MD5 hash of their content, which fixes the ugly filenames on my blog. -
Use the captions on Notion to add correct alt-text to the images.
-
Automatically generate smaller versions of images in order to optimise load times.
-
and a lot more small details…
If you want to use this tool too, you can! Head to the repository at obrhubr/notion-to-jekyll and follow the instructions. You can customise it to fit your use case with the provided command line options.