Use of property drawers after headlines

In my notes I have some org headlines. When I insert a link, a property drawer gets inserted after the headlines. So, backlinks mention the headline rather than the file-level title. How are people using this?

My headlines are likely to frequently be the same in different files. For example, a headline will be “Books”. So, I keep deleting these after they are inserted. Am I missing something useful?

Assuming you are on v2, you can have a property drawer for an Org file if you place it before the first headline (or it might need to be at the beginning of the file). Then you can insert a link with an ID pointing to the file. You should see the tile of file in completion. Is this what you are looking for?

Not exactly. The file I link from has a headline, and if I insert a link after the headline, a property drawer is inserted below the headline. Then backlinks point to that headline, rather than the title/headline of the file.

So, the file with links, looks like:

#+title: Important things

* Stuff


Then from the linked file, backlinks say “Stuff”, instead of “Important things”.

Maybe I shouldn’t be using headlines on roam notes, unless I specifically want the backlinks to go there. Or, maybe I’m not understanding why it works this way.

I don’t know why the property drawer is automatically added in the headline for you; it does not happen to me. Without an ID, a headline won’t be a node, so you should just see the title—the backlink context should be the closest node (the first node enclosing the link). I think I have no problem choosing to add or not to add an ID for each headline.

It gets added after the headline, If I use org-roam-node-insert, to insert a link, with point after the headline.

I’ll try tomorrow to double check, but I think the behaviour on my end is different and does not add an ID.

It looks like the drawer isn’t inserted if the link is to an existing file. If org-roam-node-insert creates a new file and inserts the link, then it adds the property drawer.

I have a capture template error if I insert a new link without selecting a region.
So I type text “link”, mark it, and then call node-insert.
Now after the capture process of the new Org file entitled “link”, I don’t get an ID inserted in the heading.

Given the template error I got, I have a feeling that ID insertion is somehow related to your template.

Or maybe I am doing something special. I don’t insert a link for a new file, so this is no issue for me.

Sorry, not sure; can’t reproduce the situation you are in.

This is my template:

(setq org-roam-capture-templates
      '(("d" "default" plain "%?" :if-new
         (file+head "${slug}-%<%Y%m%d%H%M%S>.org"
                    "#+title: ${title}\n#+headline: ${title}\n#+filetags: \n")
         :unnarrows t)))

I confirm the same happens to me. I’m still on v1.

Got it.

@brab’s comment was a good hint (V1 does it). Thank you.

Check the value of org-id-link-to-org-use-id. You probably have it set to t.
If I set it to t, I can reproduce what you get. Mine is nil.

You can probably use the create-if-interactive option by the looks of the variable’s documentation. See if any of them works…

An excerpt from the variable’s documentation below.

t     Create an ID if needed to make a link to the current entry.

      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.

      Like create-if-interactive, but do not create an ID if there is
      a CUSTOM_ID property defined in the entry.

      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
1 Like

Just setting org-id-link-to-org-use-id to nil seems to work. I can insert a link to a file that doesn’t exist yet and also insert a link to a file that exists, and no drawer gets created. Thanks!

It seems like the variable implies there is a reason to be inserting the property drawer, in the link source. I don’t follow what the reason for that would be.

Maybe it only had meaning in V1.