Automating ox-hugo slugs even more

A few months ago I wrote about this blog’s “slugifying workflow” and how it works. However, I’ll be honest, it’s still quite shameful how manual the whole thing is. I mean, it still requires will to manually add properties and paste the value there. It should be done automatically for you if you consider that this is inside GNU Emacs!

I wish I could write a whole blog post about the adventure of finding out the pieces I had to put together, but it was way easier than I expected.

(defun gluer/slugify-hugo-heading ()
  "Gets the current heading title, slugifies it and sets the
`EXPORT_FILE_NAME` and `EXPORT_HUGO_SLUG` properties with its
value."
  (interactive)
  (let* ((title (org-entry-get nil "ITEM"))
	 (slug (org-hugo-slug title)))
    (org-entry-put nil "EXPORT_FILE_NAME" slug)
    (org-entry-put nil "EXPORT_HUGO_SLUG" slug)
    (message "Successfully added '%s' slug." slug)))

In order to run this, you just need to press M-x gluer/slugify-hugo-heading at the level you want to add the properties (usually the top heading of your post).

For instance, this same article you are reading looks like this:

** Automating ox-hugo slugs even more                                :emacs:
:PROPERTIES:
:EXPORT_FILE_NAME: automating-ox-hugo-slugs-even-more
:EXPORT_HUGO_SLUG: automating-ox-hugo-slugs-even-more
:END:

Articles from blogs I follow around the net

The four tenets of SOA revisited

Twenty years after. In the January 2004 issue of MSDN Magazine you can find an article by Don Box titled A Guide to Developing and Running Connected Systems with Indigo. Buried within the (now dated) discussion of the technology…

via ploeh blog March 4, 2024

Building a demo of the Bleichenbacher RSA attack in Rust

Recently while reading Real-World Cryptography, I got nerd sniped1 by the mention of Bleichenbacher's attack on RSA. This is cool, how does it work? I had to understand, and to understand something, I usually have to build it. Well, friends, that is what…

via ntietz.com blog March 4, 2024

How to unbreak Dolphin on SteamOS after the QT6 update

A recent update to Dolphin made it switch to QT6. This makes it crash with this error or something like it: dolphin-emu: symbol lookup error: dolphin-emu: undefined symbol: _Zls6QDebugRK11QDockWidget, version Qt_6 This is fix…

via Xe Iaso's blog March 3, 2024

Generated by openring