YAML frontmatter tags support
Darkbluetest opened this issue · comments
Hi,
Unless I missed something, it seems that only the #hashtags are recognized in map view so to filter by tags, but not the tags defined in the note's YAMLfrontmatter. It would be better if all ways to declare tags in notes were supported, otherwise it seems risky/confusing as it "makes" two types of tags, tags readable by Map View search function and tags usable/readable by Obsidian search.
Tx
Sounds like Obsidian's CachedMetadata.tags
API does not include front matter tags, I'll add them.
I just tested this and the following already works:
---
location: [31.8340099,35.5375804]
tags:
- hike
---
With no other tags listed in the note, it gets recognized as expected.
Can you elaborate what you are doing that is not working as expected?
(I was not aware of this being natively supported but followed the example on https://help.obsidian.md/How+to/Working+with+tags and it just worked)
Yes, I tested that format and it did not work. I have just re tested it does not work on my side...
Can you share the front matter that doesn't work?
Hi
The one you posted for example. Or another I tested :
---
location: [42, 10]
tags: [me]
---
The example provided works correctly for me
I have just tested it in another, brand new, obsidian vault, with only map view plugin installed and tag panel activated, as the only modifications from vanilla obsidian. I created 2 notes. It does not work. Tested with inline and frontmatter locations...
I don't get why it does not work...
Actually reading through this again I realised that I tested wrong.
You are correct. Tags in the front matter are not checked.
I tested this right now again, exactly like the example above. A note without any tags gets marked in the correct icons when I set tags: [hike]
in the front-matter. I don't get why I can't recreate it.
@gentlegiantJGC, if you can recreate it perhaps you can track the reason the getAllTags
Obsidian API call doesn't return the right tags for you guys.
Yeh I will have a look into why it isn't working.
It was getting a bit late yesterday
Just so we are on the same page. For me the icons display correctly even if the tag is in the front matter.
What does not work correctly is the search tool.
In summary this may be a bug in Obsidian or it may be intended behaviour. I am tempted to say a bug.
this.app.metadataCache.getFileCache(file)
sometimes does not have a tags attribute even though tags are defined in the front matter.
They are available through the front matter attribute though.
I will do some more debugging later.
Looks like getAllTags
was needed. It looks like you have used this in other places but did not call it there.
#83 Fixes this issue
Added in the just-released 2.0.0 version.