I capture my notes on books that I read as org files and publish that as my bookshelf. My script grabs a lot of metadata from goodreads.com and inserts it into the org file as Hugo “front matter”. The layout specifies how this structured metadata is to be rendered for the web as static html files.
This is great because the data is structured and it is all there and I can pick and choose what I want to display and do other interesting things with it. But the problem is, having a huge json formatted data sitting at the top of the org file is distracting while I take notes on the book.
This isn’t a code file, so there isn’t a code folding function available unlike, say, when I’m editing a Python file. I can’t delimit the metadata into an org-mode code block and handle as code either because Hugo won’t understand that.
There are several folding extensions available actually… hence the name “yafolding”, which stands for “yet another folding extension”. But yafolding is really cool because it can fold by indentation depth. So it works on any text.
yafolding-toggle-all to the key chord
(key-chord-define-global "z." 'yafolding-toggle-all)
and I’m really happy to fold the long metadata into just a
will by hitting
. together and take notes on books
without any distractions.