Page that show blocks with specific tag

Things I have tried

Use Dataview plugin.

What I’m trying to do

In my daily notes I want to tag some sections for example:

#sport #running I was running for 20 minutes

And to have a page called “running” with all sections tagged #running.

In dataview I could do it with
running:: I was running for 20 mintues

but I couldn’t use two “tags” on some sections.

Is it possible to achieve this with some plugins?

1 Like

You don’t need any plugins to do this. Obsidian has a built-in query feature that can search blocks of text for things like multiple tags. For example:

```query
block:(#sport #running)
```

This says: “Show me every paragraph of text in my vault that has both the #sport and the #running tags in it.”

You can read more about the search features in the help docs.

Here’s an example:

6 Likes

Thanks, @Craig. I didn’t know about embedding queries. It almost solves it for me but it would be nice if there were an option to expand search results. I see there is a feature request for it.

This plugin will be useful for u. Need to install manually or via BRAT (search “brat” in community plugins)

Thanks @efemkay, I will try it. I hope it is compatible with 1.0. It was not updated since July 7.

I can suggest a solution with dataview. But that implies a different way to write your “metadata”.

An example with bullet point lists.

# NoteA

Lorem ipsum dolor sit amet, consectetur adipiscing elit. 

- #sport #running I was running for 20 minutes
- #sport #gymn chess-press 10x

Praesent sit amet magna vel lacus condimentum finibus id ac quam. 
# NoteB
Interdum et malesuada fames ac ante ipsum primis in faucibus. 

- #sport #running I was running for 30 minutes

Sed erat nulla, scelerisque at consectetur vel, lobortis quis mauris. 

- #running A long run 

Now the query to collect all strings with the tag #running:

TABLE WITHOUT ID
	file.link AS "Day",
	regexreplace(Lists.text, "(#\S+)+", "") AS "Runing"
FROM #running
FLATTEN file.lists AS Lists
WHERE contains(Lists.tags, "#running")

Or a query to collect all strings with the tag #sport and identify the type of sport:

TABLE WITHOUT ID
	file.link AS "Day",
	filter(Lists.tags, (t) => t != "#sport") AS "Sport",
	regexreplace(Lists.text, "(#\S+)+", "") AS "Exercise"
FROM #sport
FLATTEN file.lists AS Lists
WHERE contains(Lists.tags, "#sport")

3 Likes

Thanks @mnvwvnm.Your solution works well. The only downside is that I cannot put details inside subpoints. I maybe will try to do something like:

- #sport running 6 miles
  - #time 60 minutes 

I think Notion would allow me to achieve what I want more easily with the database but I only saw a demo so I’m not sure.

1 Like

I have asked many times for to simply tag a block and have it appear on a separate page. If you have a high level javescript it is easy and other can’t explain it without you learning javascript. I would rather not use something I do not know how to fix, or change. So the solution is below.

I use the dataview plugin and inline tags “tag:: the value you want to pull” to record quotes and ideas in a table.

I also use Css, to keep information at top of cells.

  1. Creating your custom theme CSS file in the themes directory YOUR_VAULT/.obsidian/themes/YOUR_CUSTOM_THEME.css
  2. Enabling it in the theme dropdown under Settings => Appearance => Themes

You can find this configuration in Settings => Appearance.

open the folder using theme and it will show you it in your computer systme.

use and editor to create the file.

.table-view-table > tbody > tr > td { vertical-align: top; }

I have asked many time to
—page—
#optionaltag

quote:: this is something that was quoted from a book or tweet.

  • idea:: this quote reminds me of a great idea.
    –end of page—

you call dataview by three backticks then DATAVIEW

—same page or another page —

```dataview
table quote, idea
From #optionaltag
Where quote OR idea```

—end of same page or another page —

Would it be better for you if you had something like this:

Here I’m showing two different variants to add display fields in the list, and I’ve added a little bit of custom css to make it appear more like normal text. I prefer the first variant, which then completely hides in the reading view as normal text, but it still separates the text into the desc and time fields.

My custom CSS to make inline fields look more normal

I’m mainly using Minimal in a dark theme, but I tested it in the default theme as well, and it looks similar there.

body .dataview .inline-field-standalone-value,
body .dataview .inline-field-value {
  background: var(--background-primary);
  font-size: var(--font-adaptive-normal);
  color: var(--text-normal);
}
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.