Org Roam Post

Published: December 1, 2021

A neat little feature I added to my Emacs is posting straight from Org Roam to my website. Combining it with Ox-Hugo, and configuring the Roam template so that it includes the necessary metadata. Specifically the export_file_name option. Note that Ox-Hugo doesn’t respect filetags but rather expects hugo_tags which is a little odd but I’m sure there’s a reason…

1
2
3
4
5
(org-roam-capture-templates
   `(("d" "default" plain "%?"
      :if-new (file+head "%<%Y-%m-%d>-${slug}.org"
			 "#+date: %<%Y-%m-%d>\n#+title: ${title}\n#+export_file_name: %<%Y-%m-%d>-${slug}")
      :unnarrowed t)))

and some dir-local variables to indicate the particular section I want this my notes to go into, along with a couple other configuration options

1
2
3
4
((org-mode . ((org-hugo-export-with-section-numbers . t)
	      (org-hugo-auto-set-lastmod . t)
	      (org-hugo-base-dir . "~/Public/blog")
	      (org-hugo-section . "notes"))))

Bada-bing bada-boom.