Well at last! As I've already talked about here, the missing ingredient in my blogging flow was the convenience of managing and exporting all my posts from a single org file. This flow was an inspiration from the wonderful ox-hugo package.
So it turned out Jakob had almost the same needs as me and implemented ox-haunt as a package from which to export the html and frontmatter suitable for feeding into haunt. Though since the implementation allows only for having each post as a separate file I decided to work on it a bit.
So now you can use ox-haunt for both workflows. On the multiple posts per file workflow it works like this:
- A subtree is considered valid as a post if it has the "EXPORTFILENAME" property and is marked as DONE.
- Then the subtrees metadata are converted into the frontmatter. Title is the content of the heading, date is derived from CLOSED or SCHEDULED timestamps and regular org-mode tags get converted to haunt tags.
- To export a subtree after invoking "C-c C-e" choose the option to export on a subtree level with "C-s".
- You need to define HAUNTBASEDIR as a toplevel or subtree property.
- You can define a path with HAUNTIMAGESDIR which will be used as a target of copying linked images from the org file.
- To export all posts from the current buffer use "C-c C-e A".
Since most of the usage adheres to the standard exporting flowing in org-mode it's quite easy to use! In essence it's a slight modification of the usual html org exporter. It's the first iteration so rough edges are sure to exist, but I've used it for this blog and works quite reliably for now. Be sure to check Jakob's post for some more idiosyncrasies of ox-haunt and haunt – particularly the need for a custom html reader.
For now if you want to use the multiple posts per file flow you can use my code from my fork. I've already sent a patch to Jakob. Since I find this package really useful it would be nice to get this to appear on Melpa or elsewhere, so it can be used by more people!
Thanks for reading and keep hacking.
⌨ 💘 ☠