Skip to content

Copying the generated file to the export directory

The default behavior of ‘org-roam-graph’ is to generate the graph and display it in Emacs. There is an ‘org-roam-graph-generation-hook’ available that provides access to the file names so they can be copied to the publishing directory. Example code follows:

emacs-lisp
(add-hook 'org-roam-graph-generation-hook
          (lambda (dot svg) (if (< (- (cadr (current-time)) my-publish-time) 5)
                                (progn (copy-file svg "~/roam-export/sitemap.svg" 't)
                                       (kill-buffer (file-name-nondirectory svg))
                                       (setq my-publish-time 0)))))