# A different canonical ‘title’ for subheadings with Org IDs?

**URL:** https://org-roam.discourse.group/t/a-different-canonical-title-for-subheadings-with-org-ids/3564
**Category:** UX & UI
**Created:** [August 21, 2024, 11:16am UTC](https://org-roam.discourse.group/t/a-different-canonical-title-for-subheadings-with-org-ids/3564 "2024-08-21T11:16:23Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![butter-radish](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@butter-radish](https://org-roam.discourse.group/u/butter-radish)
#### Post date: [August 21, 2024, 11:16am UTC](https://org-roam.discourse.group/t/a-different-canonical-title-for-subheadings-with-org-ids/3564/1 "2024-08-21T11:16:23Z")

</div>

When I make subheadings into their own nodes (by giving them IDs), nearly all of the time I would prefer they have a different title for search (-ing from everywhere else) than the heading’s name in the document. So, for example, if I make the “History” subheading in the file “Pink” into its own node, I’d like to label it “History” within the document but I’d prefer to search for it with “History of Pink”, and only search for it as “History of Pink”. If I use aliases, the generic title “History” would get cluttered pointing to many different nodes.

I understand why titles have to be unique, but I don’t like making these wordy subheading inside larger documents that makes them harder to read—it’s not how subheading should be. Can’t we have a feature where we can set a “canonical title” or “alias” of sorts for subheadings that are nodes, different from the actual text of the subheading, which will be the only thing they can be searched by?

---

<div class="post-metadata">

### Author: ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)
#### Post date: [August 21, 2024, 1:49pm UTC](https://org-roam.discourse.group/t/a-different-canonical-title-for-subheadings-with-org-ids/3564/2 "2024-08-21T13:49:24Z")

</div>

> [@butter-radish](#):
>
> Can’t we have a feature where we can set a “canonical title” or “alias” of sorts for subheadings that are nodes, different from the actual text of the subheading, which will be the only thing they can be searched by?

Don’t think this particular feature is available now. I would try this first for your desire: [User contributed Tricks · org-roam/org-roam Wiki · GitHub](https://github.com/org-roam/org-roam/wiki/User-contributed-Tricks#showing-node-hierarchy)

---

<div class="post-metadata">

### Author: ![dmg](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dmg](https://org-roam.discourse.group/u/dmg)
#### Post date: [August 22, 2024, 2:01am UTC](https://org-roam.discourse.group/t/a-different-canonical-title-for-subheadings-with-org-ids/3564/3 "2024-08-22T02:01:25Z")

</div>

> [@butter-radish](#):
>
> I understand why titles have to be unique,

Titles do not have to be unique. IDs must.

Why not create IDs that have this structure: eg. the ID of this node would be pink-history then you can search for History Pink and find the corresponding node.

it is also doable to create a hierarchical search using sqlite and some custom code: match any node that has any of the substrings in the current node (at least one) and its parents (any of the remaining ones)

---

<div class="post-metadata">

### Author: ![dmg](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dmg](https://org-roam.discourse.group/u/dmg)
#### Post date: [August 22, 2024, 3:03am UTC](https://org-roam.discourse.group/t/a-different-canonical-title-for-subheadings-with-org-ids/3564/4 "2024-08-22T03:03:35Z")

</div>

> [@butter-radish](#):
>
> Can’t we have a feature where we can set a “canonical title” or “alias” of sorts for subheadings that are nodes, different from the actual text of the subheading, which will be the only thing they can be searched by?

I poked a bit at the database. This info is already in the table nodes: the attribute olp is a list of the titles of the parents. This means it is relatively straightforward to write a function that uses this data to search. It might be as simple as writing a template to the org-roam-visit-node function that includes olp and title.

Otherwise, one of the functions that @akashp wrote some time ago to improve the access to the DB can be modified to return this data as a string, instead of the title  
…  
after poking at the code… all you need to do is modify your template to include “olp”. It will show the parents of the node as a list separated by " \> ". Very nice.

---

<div class="post-metadata">

### Author: ![butter-radish](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@butter-radish](https://org-roam.discourse.group/u/butter-radish)
#### Post date: [October 24, 2024, 6:06am UTC](https://org-roam.discourse.group/t/a-different-canonical-title-for-subheadings-with-org-ids/3564/5 "2024-10-24T06:06:01Z")

</div>

Thank you so much, this is pretty much what I wanted: the hierarachy to be visible. I’d have preferred to be able to format it differently on a node-to-node basis,\[1\] but the “\>” is simple and universal so it’s a small peeve.

* * *

1. E.g. maybe in a node about an artist with subheading being their works—the whole thing could be formatted as `“Work”, by Artist` in Org-roam’s search.

---

<div class="post-metadata">

### Author: ![butter-radish](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@butter-radish](https://org-roam.discourse.group/u/butter-radish)
#### Post date: [October 24, 2024, 6:10am UTC](https://org-roam.discourse.group/t/a-different-canonical-title-for-subheadings-with-org-ids/3564/6 "2024-10-24T06:10:14Z")

</div>

In the default search interfaces, `org-roam-capture` and `org-roam-node-find`, only a single title out of identical ones (having unique IDs) is displayed—so, in practise, it might as well be that you need unique titles.

---

<div class="post-metadata">

### Author: ![dmg](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dmg](https://org-roam.discourse.group/u/dmg)
#### Post date: [October 24, 2024, 6:22am UTC](https://org-roam.discourse.group/t/a-different-canonical-title-for-subheadings-with-org-ids/3564/7 "2024-10-24T06:22:06Z")

</div>

By default, yes, but it can be configured to show any information on the node.

---

<div class="post-metadata">

### Author: ![butter-radish](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@butter-radish](https://org-roam.discourse.group/u/butter-radish)
#### Post date: [October 24, 2024, 6:33am UTC](https://org-roam.discourse.group/t/a-different-canonical-title-for-subheadings-with-org-ids/3564/8 "2024-10-24T06:33:34Z")

</div>

Yep, just learnt that thanks to y’all!
