Moving from WordPress to Obsidian Plus Hakyll

ankitg121 pts0 comments

Moving from WordPress to Obsidian plus Hakyll - codeutopia.net

Moving from WordPress to Obsidian plus Hakyll

Posted on May 1, 2026

Tags: haskell, hakyll, blogs, obsidian, wordpress

In this post I’ll show you how to export a WordPress blog, import it into Obsidian, and finally turn it into a website using Hakyll.

This conversion has the following features/requirements - some are easily achieved, others require custom implementation in code:

A reasonable folder structure in Obsidian, with useful frontmatter fields

Wikilink support

Support for embedded images

Support for tags

Archives for year and month

Support for Obsidian’s callouts

This post is split into two sections. First, why I moved from WordPress, and why these technical choices. After, I’ll show you the steps needed to do this yourself. Note that this requires some technical skills to go from WordPress into Obsidian, and understanding of Haskell to go from Obsidian to Hakyll.

Background

It’s been 9 years since my previous post. It has been 18 years since I started using WordPress here. I never intended to take such a long break from writing, it just happened as these things tend to do.

I thought it would be fun to write again, but the old blog felt old. I had also started using Obsidian a lot for keeping notes on things. So I thought: can’t I just use Obsidian to write articles/blogposts as well? Static site generators had also become popular, and I knew I could use them to build a site from Markdown files.

I’ll have to write about what makes Obsidian an excellent writing tool another time - but if I can write in Obsidian and generate a site from that, that would be ideal.

Requirements

Since I don’t want to lose any of my old content, the first requirement is I need to be able to import all my blog content into Obsidian. This means I would somehow have to dump all the old content from WordPress into Markdown files. My initial thinking was “I guess I’ll just dump it from MySQL?” which would have been a pain, but thankfully I had the common sense to search first, as I found a useful Node.js based tool that can do the work. It did require some changes, more on which in the technical detail part of this post.

I also want to write in Obsidian in the same way as I would normally - I want to avoid any extra steps to write blog content compared to writing other notes. This means the directory structure should accommodate Obsidian usage and not the website, and that I can use Obsidian’s markdown features in the pages as normal. I figured this can’t be a big issue - Obsidian uses Markdown, surely there’s not any problems with that? Which was partially true. Most of the markdown formatting worked out of the box, but a few more specific features required custom coding.

Finally, it must retain at least the key features and the URL structure of the old blog, so that all the old links to the website and links within my own content remain functional. This shouldn’t be a problem, you can do all kinds of tricks with Apache’s RewriteModule if needed.

Why Obsidian and Hakyll?

I wanted to use Obsidian because I’m already using it for writing other things. There are multiple reasons why I like it, but some of the main ones are it’s lightweight and easy to use, and it makes it easy to link the content to my other notes. The hope is that this gives me more insights and allows writing better content, because I can find connections and related things more easily - whether this happens remains to be seen.

I’ve previously used Quartz for generating a website from Obsidian. It worked reasonably well for publishing my Unreal Engine notes, but I wasn’t entirely happy with it. For example, it would have required large changes to support a blog type site. There were also other small annoyances with Quartz that made me consider other options - primarily tools like Jekyll and Hakyll.

Ultimately I landed on Hakyll, a Haskell-based static site generator. If you’ve seen me write about Haskell in the past, you can probably guess why: I picked it so I could do something in Haskell, because I like Haskell, and I don’t have enough opportunities to use it for something useful. It turns out Hakyll was a great choice, because it integrates well with Pandoc - which is perhaps the best tool to process Markdown. More on that in the technical details section.

Finally, getting rid of WordPress means no more WP vulnerabilities. Not that it has been a problem - since I’ve not been using it much, I just write-protected everything, and WP exploits tend to work through writing into files. But in any case, a static site has less surface.

Technical steps

There are three parts to moving from WordPress into Obsidian and configuring Hakyll:

First, we need to export data out from WordPress and get it into an Obsidian-friendly format

Next, we need to import the files into an Obsidian vault (ok this is like a half-step at most)

Finally the most complicated part: Building a website...

obsidian from wordpress hakyll write content

Related Articles