Writing a book with Hugo?

Howdy, folks.

I’m collaborating with a team on a book. The preferred markup formats (Markdown, reStructuredText, Org Mode) vary wildly, sometimes even within the same chapter, and thus I’m looking at Hugo because it does such a good job at supporting so many formats. Also, the nature of the content in the book --deeply technical – is such that we will benefit from being able to partial-ize some of the content.

I see some older posts in this forum where folks have asked about Hugo for book composition but those posts don’t seem to lead anywhere really.

Perhaps someone here has been down the book authoring/composition path recently and can provide references or advice?

Much appreciated.

1 Like

I collect some ideas and tricks im my sample project and added my book templates now.

You are free to checkout it from GitHub and use what you need.

HTH

2 Likes

@ju52 It seems that in the sample project, partial for book-head is missing. I reused single-head.html so it can be checked quite nicely.

was in .gitignore - now online
SORRY

2 Likes

Thanks for sharing, folks! The book is a bit of a passion project at the moment. As I make progress I will share any advice I might have on using Hugo for this task.

If you or other authors are familiar with Org mode, I’d recommend using that format :grin:.

Additionally, if you use Emacs, try out the ox-hugo package (disclaimer: I am the author). It allows you to write complex texts, possibly multiple book chapters within the same Org file into different subtrees, and they all export to separate Markdown files in intended path hierarchies, which are then processed by Hugo. Of course, ox-hugo deals will exporting the front-matter as well.

You mentioned that the book is deeply technical. If that means that you have a lot of code blocks, and probably want to embed the results of those as well in your book, Org Babel works great here. (Example: I maintain my Nim notes here, written in Org, published using Hugo.)

I’m absolutely with you. Most of what I write these days whether for work or fun is in Org Mode/Org Roam and then exported. The other authors are often hung up on the “Ew…Emacs?!” thing.

Perhaps working alongside me on this book will open some eyes as to how great is Org Mode. Particularly, as you point out, when dealing with code/example snippets.