# Couple of tweaks for org-publish backlinks function

**URL:** <https://org-roam.discourse.group/t/couple-of-tweaks-for-org-publish-backlinks-function/988>\
**Category:** Tips\
**Created:** [November 21, 2020, 6:37pm UTC](https://org-roam.discourse.group/t/couple-of-tweaks-for-org-publish-backlinks-function/988 "2020-11-21T18:37:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![doubleloop](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/doubleloop/32/99_2.png) [@doubleloop](https://org-roam.discourse.group/u/doubleloop)\
**Post date:** [November 21, 2020, 6:37pm UTC](https://org-roam.discourse.group/t/couple-of-tweaks-for-org-publish-backlinks-function/988/1 "2020-11-21T18:37:14Z")

</div>

After updating to 1.2.3 I noticed that my backlinks weren’t publishing during org-publish, using the `org-roam--backlinks-list` example function that was in the org-roam docs back in the day (which no longer seems to be there.)

Couple of updates required:

- function `org-roam--get-title-or-slug` has been deprecated ([https://github.com/org-roam/org-roam/commit/face683e00c2fe6c45f6958f05bef1750e7372df](https://github.com/org-roam/org-roam/commit/face683e00c2fe6c45f6958f05bef1750e7372df)). `org-roam-db--get-title` looks like the new way to do this.
- the backlinks query was using `from` and `to` which are now `source` and `desc` ([https://github.com/org-roam/org-roam/pull/1213/commits/399c94b121a124a42493d713fd955cef58767100](https://github.com/org-roam/org-roam/pull/1213/commits/399c94b121a124a42493d713fd955cef58767100))

So the tweaked function I’m using now is:

```auto
(defun commonplace/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-db--get-title (car it))))
       "" (org-roam-db-query [:select [source] :from links :where (= dest $s1)] file))
    ""))

```

I noticed [here](https://github.com/jethrokuan/dots/blob/0064ea2aab667f115a14ce48292731db46302c53/.doom.d/config.el#L495) that @jethro has a slightly different function for this, so the general use of elisp there is probably better.

---

<div class="post-metadata">

**Author:** ![jethro](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jethro](https://org-roam.discourse.group/u/jethro)\
**Post date:** [November 22, 2020, 6:02am UTC](https://org-roam.discourse.group/t/couple-of-tweaks-for-org-publish-backlinks-function/988/2 "2020-11-22T06:02:42Z")

</div>

I no longer generate backlinks using Org-roam’s db: i just use Hugo’s templating functionality.
