Hugo descriptions with ox-hugo

In a previous post, I explained how slugify this blog’s headings. Now, I’m going demonstrate how I do to insert front matter descriptions.

Currently, there are two ways to make ox-hugo insert a description attribute in a post’s front matter. The first method leverages the property EXPORT_HUGO_CUSTOM_FRONT_MATTER:

* Your cool title
:PROPERTIES:
# other props...
:EXPORT_HUGO_CUSTOM_FRONT_MATTER: :description Your cool description
:END:

Now, the one I use is made with the help of Org Mode’s Blocks.

* Your cool title
:PROPERTIES:
# other props...
:END:

#+begin_description
Your cool description
#+end_description

By default, the easiest way to insert one is to run the press C-c C-, TAB description. However, this is keybinding sequence is quite long. In comparison, inserting a source block only requires C-c C-, s. So, why not have d as an option to select description? Here is how I did it.

I started by running C-h k (describe-key) and then C-c C-, to find out which command was associated with this keybinding. It turns out that it runs org-insert-structure-template, that selects a block from the variable org-structure-template-alist. Running C-c v (describe-variable) showed me the default value for this variable:

(("a" . "export ascii")
 ("c" . "center")
 ("C" . "comment")
 ("e" . "example")
 ("E" . "export")
 ("h" . "export html")
 ("l" . "export latex")
 ("q" . "quote")
 ("s" . "src")
 ("v" . "verse"))

Well, now it’s simply a matter of adding the ("d" . "description") value to the list and we should be good to go:

(add-to-list 'org-structure-template-alist '("d" . "description"))

Articles from blogs I follow around the net

Variations of the Range kata

In the languages I usually employ. The Range kata is succinct, bordering on the spartan in both description and requirements. To be honest, it's hardly the most inspiring kata available, and yet it may help showcase a few in…

via ploeh blog January 1, 2024

Some notes on NixOS

Hello! Over the holidays I decided it might be fun to run NixOS on one of my servers, as part of my continuing experiments with Nix. My motivation for this was that previously I was using Ansible to provision the server, but then I’d ad hoc installed a bunch…

via Julia Evans January 1, 2024

I found some of my first code! Annotating and reflecting on robotics code from 2009.

In high school, one of my teachers shattered my plans for my life, in the most beautiful way. Most of my life, I'd intended to become a math professional of some sort: a math teacher, when that was all I saw math for; an actuary, when I started to lear…

via ntietz.com blog January 1, 2024

Generated by openring