Blogging With Hugo and Org Babel

I think I have finally found a blogging platform that makes me happy. It needs to fit my programmer's workflow – git, markup and blogging about code. Hugo with org-babel nails it.

Hugo is a really nice open-source static site generator - It supports a variety of markup formats including the ubiquitous markdown, but also Emacs Org Mode files. This opens the way to using org-babel for blogging with inline code snippets that can be evaluated. Hello literate blogging! And did I mention polyglot?

How Easy?

# create a new site
hugo new site

# add a theme

# create a new post
hugo new post/

# edit away

# try it locally
hugo serve -D
# open http://localhost:1313/

# publish
hugo && rsync -avz --delete public/ <destination>

Tour Of Inlines


echo "Hello from shell!"
Hello from shell!

Inline C

printf("Hello worldies!\n");
Hello worldies!


print "Hello World\n";
Hello World


select * from users;
Donald Hunter donaldh

Introducing Perl 6


And the version is:

Perl 6 (6.c)

I cannot remember the provenance of this ob-perl6 language driver. I think I found it on github but it has since disappeared. You can get it from my dotfiles here:

How do you like your fibonacci:

(1, 1, * + * ... *)[^10].join: ', '
1, 1, 2, 3, 5, 8, 13, 21, 34, 55

Graphs With Dot



Hugo uses for parsing Org-mode files and it turns out there are a few bugs. They look relatively simple to fix so I'll delve into that soon.

Update: Of course, now that the bugs are resolved, the static site generator made everything below look fine.


 Nobody expects any commentary.

This generates spurious <p> tags inside a <pre> block, and syntax highlighting happens:

Nobody expects any commentary.

When, in fact, comments should be ignored.



This also adds <p> tags, this time inside a <blockquote>, instead of <br/>

Mary had a little lamb, Its fleece was white as snow Everywhere that Mary went, The lamb was sure to go

Centered Text


Same thing happening here:

Hello centered world! Why such spacing though?


Mary had a little lamb, Its fleece was white as snow Everywhere that Mary went, The lamb was sure to go

comments powered by Disqus