Using Namespaces Instead of Prefixes in Roam Research
Some Roam Research users use page title prefixes in order to quickly differentiate between different types of content. E.g.: “B: How To Take Smart Notes” for the book, and “A: How To Take Smart Notes” for an article about it.
Roam Research has a feature built-in with similar advantages and additional features: namesspaces.
Namespaces are, and are simply created, by using a backslash / in the page title. In our examples we might end up with “Book/How To Take Smart Notes” and “Article/How To Take Smart Notes”
Added Advantages
Semi-Automatic Namespace Collation
Typing [[Book/How To Take Smart Notes]] somewhere will:
- Create the page Book/How To Take Smart Notes
- If you go to the page [[Book]], the link, your mention of the page, will show up under Unlinked References.
- If you go to the page [[How To Take Smart Notes]], the link, your mention of the page, shows up there under Unlinked References as well.
Note that [[Book/How To Take Smart Notes]] is just a page title, just like any other, so in and by itself it will not make the page show up as a reference on the Book page.
Folders on Export
When doing an export to Markdown, the namespaces will become folders, and the last part of the namespace will be a regular file in that folder.
This has two advantages:
- Natively avoids name collission
- File system safe filenames. Prefixing a page title with something like “B: How To Take Smart Notes” can cause problems when extracting your ZIP file in Windows, as the colon is a forbidden character in filenames. Utilities like 7zip can replace the forbidden character with an underscore, but this will break your links to the file in the other files.
Clean Display Options
The initial default for displaying namespace links is to show the whole link.
Using the shortcut sequence CTRL C followed by CTRL L you can cycle through that option, abbreviated, or isolated:
- [[Book/How To Take Smart Notes]]
- [[B/How To Take Smart Notes]]
- [[How To Take Smart Notes]]
The color of the links will change according, so visually it is readily apparent 2 & 3 are namespace links