0

I've been using Org's handy link abbreviation feature in Org documents:

#+link: Google https://google.com/


* Test Org Links

Here's an abbreviated link: [[Google][This is Google search]].

Which works as expected, including opening the link. Because I have the same link abbreviations used across multiple Org files, I'd like to place them in a links.org file:

#+link: Google https://google.com/

Then include that file in other Org files:

#+INCLUDE: "links.org" src org

* Test Org Links

Here's an abbreviated link: [[Google][This is Google search]].

With this setup the links are exported correctly (for example to HTML) but they're not openable in the Org buffer. Org lint also flags them as Unknown fuzzy location.

Are there extra steps or setup needed to use external link abbreviations this way? I understand there's an Emacs alist that can be used to store the link abbreviations but I need a self-contained Org document repository.

1 Answer 1

0

#+INCLUDE directives are processed on export only. What you want is #+SETUPFILE:

#+SETUPFILE: links.org

* Test Org Links

Here's an abbreviated link: [[Google][This is Google search]].

The linked documentation says:

 ‘#+SETUPFILE: file’
     The setup file or a URL pointing to such file is for additional
     in-buffer settings.  Org loads this file and parses it for any
     settings in it only when Org opens the main file.  If URL is
     specified, the contents are downloaded and stored in a temporary
     file cache.  ‘C-c C-c’ on the settings line parses and loads the
     file, and also resets the temporary file cache.  Org also parses
     and loads the document during normal exporting process.  Org parses
     the contents of this document as if it was included in the buffer.
     It can be another Org file.  To visit the file—not a URL—use ‘C-c
     '’ while point is on the line with the file name.
1
  • Excellent -- thank you.
    – stu002
    Aug 18, 2022 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.