Customize the variable org-id-link-to-org-use-id
and set it to t
(AKA Create ID to make link
). Then when you do C-cl (i.e. org-store-link
), an ID
property will be added to the headline with a UUID as value. When you save the link somewhere else (perhaps in another file) with C-cC-l (i.e. org-insert-link
), the link will appear like this:
[[id:b7b07a14-5dbb-48ed-9d9d-70df49e83231][Heading]]
Clicking it will take you back to the file and heading that has this UUID as the value of its ID
property.
You might find that creating an ID every time you store a link (particularly if that happens as a result of a capture) creates a lot of useless IDs. The other possible values of org-id-link-to-org-use-id
might help. The docstring says:
Non-nil means storing a link to an Org file will use entry IDs.
The variable can have the following values:
t Create an ID if needed to make a link to the current entry.
create-if-interactive
If ‘org-store-link’ is called directly (interactively, as a user
command), do create an ID to support the link. But when doing the
job for capture, only use the ID if it already exists. The
purpose of this setting is to avoid proliferation of unwanted
IDs, just because you happen to be in an Org file when you
call ‘org-capture’ that automatically and preemptively creates a
link. If you do want to get an ID link in a capture template to
an entry not having an ID, create it first by explicitly creating
a link to it, using ‘C-c l’ first.
create-if-interactive-and-no-custom-id
Like create-if-interactive, but do not create an ID if there is
a CUSTOM_ID property defined in the entry.
use-existing
Use existing ID, do not create one.
nil Never use an ID to make a link, instead link using a text search for
the headline text.
You can customize this variable.
Some experimentation will be needed to find what's comfortable for you.