Export org-roam backlinks with Gohugo

March 7, 2021
emacs, orgroam, orgmode

tags Org-mode Emacs Org-roam Since Org-roam export backlinks on Hugo no longer works, I found a solution to handle backlinks in Hugo itself. The following Hugo partial template will add backlinks to a note if any. {{ $re := $.File.BaseFileName }} {{ $backlinks := slice }} {{ range .Site.AllPages }} {{ if and (findRE $re .RawContent) (not (eq $re .File.BaseFileName)) }} {{ $backlinks = $backlinks | append . }} {{ end }} {{ end }} <hr> {{ if gt (len $backlinks) 0 }} <div class="bl-section"> <h4>Links to this note</h4> <div class="backlinks"> <ul> {{ range $backlinks }} <li><a href="{{ . ...

Ox-hugo export all roam to Hugo

June 4, 2020
emacs, orgmode, hugo, orgroam, roam

tags Emacs Org-mode Org-roam Export all org-roam files to Hugo markdown (this might take some time) From: jethrokuan/dots (defun benmezger/org-roam-export-all () "Re-exports all Org-roam files to Hugo markdown." (interactive) (dolist (f (org-roam--list-all-files)) (with-current-buffer (find-file f) (when (s-contains? "SETUPFILE" (buffer-string)) (org-hugo-export-wim-to-md))))) Adding an empty #+SETUPFILE: forces benmezger/org-roam-export-all to export the file.