Display All Instances of a Hashtag on a New Page

Use case or problem

I am in the process of categorising my book highlights and notes into Obsidian. I spend time going through each note and assigning it a hashtag at the end. I separate the individual quotes at the top and the bottom with lines (—).

I realised however, that I cannot click a hashtag and see a page showing all instances (in my case quotes) with the hashtag assigned.

The closest I can do is search for the hashtag and see maybe a short few words of context in the thin side pane.

Proposed solution

I would suggest a page generated upon clicking a hashtag where all instances of the hashtag are used along with their associated context.

For example:

Click ‘#wisdom’ → Page full of all quotes tagged with ‘#wisdom’ presented.

Current workaround (optional)

Currently I search for all uses of the hashtag using the search function, but I am only able to see maybe 4-5 words of context and I have to constantly expand the results to see them all.

3 Likes

Try:
line:(/.*\#sometag.*/)

Or replace line with section.

Hi Ryan, thanks for the reply.

I tried that syntax as part of a query, but sadly it did not return the expected results.

To clarify, my quotes on a page look like this (lines at the top and bottom of each quote included:


“quote from a book I have read.”
#tag1 #tag2 #tag3


However when I run the query using the syntax you provided, I only get this returned:

#tag1
#tag1
#tag1

This happens if I use “line:” or “section:”.

Is there another term I can use that will display the whole quote?

Ah if the tags are on a different line, the line trick won’t work. I don’t think there’s a way to force Obsidian to show all text in a section, sadly.

Would I be able to formally request this to be a feature? (Or the same result implemented in a different way)?

This thread is the feature request! I was just suggesting a workaround.

You might want to check out the dataview community plugin; it might be able to do what you want, too.

To be honest, I wouldn’t want obsidian to create a new page each time I am searching for a tag…

For your use case - which should, I guess, only be relevant from time to time - I would suggest that you copy your search results (there is already a clickable item for this) as links, copy them to your wanted page and manually prefix your links with ! - that would show you a readable list with all your quotes regarding a certain topic!

2 Likes

As a side note, if it is a super long list, it can be a timesaver to do a find and replace. Find [[ and replace with ![[

Thanks.

2 Likes

Copying search results just copies the title of the note, not the context around the searched for hashtag.