Skip to main content

New and improved!

After many troubles tries errors and pulled hair, I finally figured out how to redesign this blog using hugo, and make it work with ox-hugo. That way I can use the well established org-mode markup instead of having to worry about markdown markup which always throws me in for a loop. This way I can keep all my content in one giant org file, and have it published more or less automatically. There are few things where I slightly deviated from what’s written in the manual though

Using yasnippet instead of org-capture-template

While org-mode provides excellent feature in form of org-capture templates and ox-hugo manual does provide a snippet of code, for one to dump into the config file, it also assumes that you have the source file in specific location namely whatever you set into org-directory variable which doesn’t necessarily have to be the same directory where you’re hosting the blog’s repository. So I’ve used yasnippet plugin instead. I simply called the yas-new-snippet function inside an .org file with C-c & C-n and in the window that popped up I’ve put in following code

# -*- mode: snippet -*-
# name: hugo new post
# uuid:
# key: hugo-post
# condition: t
# --
* TODO $1
:PROPERTIES:
:EXPORT_FILE_NAME: `(format-time-string "%d-%m-%Y-")` ${1:$(downcase yas-text)}
:END:
$0

After that I can either use a hugo-post keyword followed by Tab key or use SPC i s to insert specific snippet