Add backlinks when exporting to html

This commit is contained in:
Thomas Dehaeze 2020-04-16 19:09:03 +02:00
parent 9770c87b3a
commit c380a48df9

View File

@ -2107,6 +2107,26 @@ Nice Functions:
)
#+end_src
#+begin_src emacs-lisp
(defun my/org-roam--backlinks-list (file)
(if (org-roam--org-roam-file-p file)
(--reduce-from
(concat acc (format "- [[file:%s][%s]]\n"
(file-relative-name (car it) org-roam-directory)
(org-roam--get-title-or-slug (car it))))
"" (org-roam-db-query [:select [from] :from links :where (= to $s1)] file))
""))
(defun my/org-export-preprocessor (backend)
(let ((links (my/org-roam--backlinks-list (buffer-file-name))))
(unless (string= links "")
(save-excursion
(goto-char (point-max))
(insert (concat "\n* Backlinks\n") links)))))
(add-hook 'org-export-before-processing-hook 'my/org-export-preprocessor)
#+end_src
** Helm-Bibtex ([[https://github.com/tmalsburg/helm-bibtex][link]])
#+begin_src emacs-lisp
(use-package! helm-bibtex