Next: , Previous: , Up: Top   [Contents]


9 Inserting Links

The preferred mode of linking is via file links to files, and id links for headlines. This maintains the strongest compatibility with Org-mode, ensuring that the links still function without Org-roam, and work well exporting to other backends.

file links can be inserted via org-roam-insert. Links to headlines can be inserted by navigating to the desired headline and calling org-store-link. This will create an ID for the headline if it does not already exist, and populate the Org-roam database. The link can then be inserted via org-insert-link.

An alternative mode of insertion is using Org-roam’s roam links. Org-roam registers this link type, and interprets the path as follows:

[[roam:title]]

links to an Org-roam file with title or alias “title”

[[roam:*headline]]

links to the headline “headline” in the current Org-roam file

[[roam:title*headline]]

links to the headline “headline” in the Org-roam file with title or alias “title”

roam links support auto-completion via completion-at-point: simply call completion-at-point within a roam link. Users of company-mode may want to prepend company-capf to the beginning of variable company-backends.

To easily insert roam links, one may wish to use a package like key-chord. In the following example, typing “[[” will insert a stub roam link:

(key-chord-define org-mode-map "[[" #'my/insert-roam-link)

(defun my/insert-roam-link ()
    "Inserts an Org-roam link."
    (interactive)
    (insert "[[roam:]]")
    (backward-char 2))

Next: , Previous: , Up: Top   [Contents]