How to Use Nested Tags
Many people use tags as a way to add some context to their documents. We have blogged on the subject more than once, e.g., in our article Understanding Tagging. But one option some people may not be aware of is nested (or hierarchical) tags. These are tags with child tags, or related tags within tags. Here’s how you can make and use them in DEVONthink.
What are nested tags?
Nested tags allow you to gather related tags into a hierarchy, with one tag branching into child tags. Many of you will already be familiar with this concept from school: the plant and animal kingdom taxonomies. In a simple (and perhaps truncated) example, Animal leads to Mammal, eventually leading to Canidae, and down to Canis lupus, the wolf. In DEVONthink, this could be shown as the nested tags hierarchy Animal > Mammal > Canidae > Canis lupus.
One benefit of nested tags is inheritance. Just as you inherit the name and some genetic traits of your parents, child tags inherit the tags of their parents and grandparents. In the previous example of the wolf, adding another animal to the Canidae tag, e.g., Canis latrans or the coyote, it would automatically inherit the Animal, Mammal, and Canidae tags.
For a less scientific example, imagine nested tags of Australia > New South Wales. Adding Sydney to New South Wales will get that tag as well as Australia. Adding other city tags would get them those parent tags too. And adding a child tag of Macquarie Lighthouse to the Sydney tag would inherit all three tags above it.
How to Create Nested Tags
Creating nested tags can be done in the Tags group for a database:
- Create tags and drag and drop them into each other.
- Select a tag, then choose Data > Group Items. This will create a parent group with the selected group inside it, so name it appropriately.
- Double-click a tag in the Tags group, create a new tag, and repeat as deep as you need to go.
However, there are two other ways to create nested tags:
- In the Tools > Inspectors > Generic Info inspector, the View > Show Tags bar, or even the Sorter, you can create nested tags by using a slash-delimited path. So typing
Personal/Finance/Taxes
would create the nested tags hierarchy Personal > Finances > Taxes. - Following the preceding method, you can add a slash-delimited hashtag, e.g.,
#Coding/AppleScript
, in the content of plain text, rich text, and Markdown documents. Then enable Preferences > Files > Import > Tags > Convert hashtags to tags and the hierarchy will be created in the database’s Tags groups. Please remember hashtags don’t support spaces.
One important thing to be aware of is tag redundancy. You do not want to create redundant tags in a database. If you do, the application will choose the last created redundant tag. In the above example, perhaps you added the lighthouse to a Lighthouse tag. Then you added Newcastle > Lighthouse > Nobbys Lighthouse, so you have two Lighthouse tags, one in each city. Now, if you apply the Lighthouse tag to any document, DEVONthink will choose the most recent Lighthouse tag. Instead of creating redundant tags, you should create a Lighthouse tag outside the nested tags.
We hope this helps give you some ideas on how you can use nested tags and avoiding some pitfalls in your own databases.