Importing blog posts from Django to Hugo

2019-08-31

Last year I started a sort of basic Dango-based sort of simple blog just to jot down small software-related learnings in Markdown. I hosted it on Heroku, which is free but sleeps after 30 minutes of inactivity. That’s OK for me as a user, but I would not want potential visitors to have to wait for the instance to wake up. At the same time, not sure it’s worth paying for Django hosting just for such a minor project.

Live site: https://nerdlog.herokuapp.com

Code: https://github.com/jperals/dyk

Almost in parallel I built my website using Hugo, which is blog-friendly but, being based on static files, doesn’t come with the nicer UX that I had already built on my Django site —and I know that I might stop writing if it becomes just a bit uncomfortable to do so.

Live site: https://perals.io

Code: https://github.com/jperals/perals.io

They are two very different systems, but both are based on Markdown, so I built a script to import the posts from the Django site to the Hugo site, which is working quite well. The script is currently part of the code of my website, and it’s one single Node.js script with no dependencies (yet?):

https://github.com/jperals/perals.io/blob/master/update-blog-posts.js