obsidian-iconize icon indicating copy to clipboard operation
obsidian-iconize copied to clipboard

[Suggestion] - Automatically add icon based on tags/frontmatter

Open ReedWriter opened this issue 3 years ago • 3 comments

It would be great to have the ability to define and add an icon either by the tags a note contains or through frontmatter.

ReedWriter avatar Feb 08 '22 22:02 ReedWriter

Lovely idea. I need to think of it. Thanks for the suggestion!

FlorianWoelki avatar Feb 09 '22 10:02 FlorianWoelki

@ReedWriter : could the SuperCharged Links plugin be what you need?

stecydube avatar Apr 02 '22 10:04 stecydube

So, for example, if a file is a png, jpg, bmp it would load a specific icon, and if the file extension was something else like md it would have a different icon? Am I understanding that correctly? I love that idea.

varpness avatar Apr 09 '22 17:04 varpness

This could be a great improvement to the plugin

Majoramari avatar Aug 18 '23 20:08 Majoramari

I understood this feature request to be to extend the existing "Custom Icon Rules" feature, which currently matches with regexes against file names, to also match against tags.

So - as an example - a file tagged with 'idea' might be automatically assigned the icon for 'llightbulb'.

This would be useful to me in a number of contexts. For example, I would like to add an icon to the folder index document. The name of that document depends on the folder name, so this is unpredictable, but all of these documents have a tag called "index" in the frontmatter. It would be great if these showed up in the file explorer with an automatically assigned icon.

Anyway - thanks for the very useful plugin :-)

paulwalk avatar Oct 04 '23 09:10 paulwalk

I understood this feature request to be to extend the existing "Custom Icon Rules" feature, which currently matches with regexes against file names, to also match against tags.

So - as an example - a file tagged with 'idea' might be automatically assigned the icon for 'llightbulb'.

This would be useful to me in a number of contexts. For example, I would like to add an icon to the folder index document. The name of that document depends on the folder name, so this is unpredictable, but all of these documents have a tag called "index" in the frontmatter. It would be great if these showed up in the file explorer with an automatically assigned icon.

Anyway - thanks for the very useful plugin :-)

Thank you! What you've described seems to be already possible in Iconize.

FlorianWoelki avatar Oct 05 '23 06:10 FlorianWoelki

@FlorianWoelki I can't see this functionality....?

If I tag a file with the tag idea, how do I select for this in the Custom Icon Rules? With other plugins, the convention is to use #idea, but this doesn't work.

I have tried each of these Custom Icon Rules to match files tagged with idea:

  • idea
  • #idea
  • tag:idea
  • tag:#idea

What am I missing?

paulwalk avatar Oct 05 '23 07:10 paulwalk

@FlorianWoelki I can't see this functionality....?

If I tag a file with the tag idea, how do I select for this in the Custom Icon Rules? With other plugins, the convention is to use #idea, but this doesn't work.

I have tried each of these Custom Icon Rules to match files tagged with idea:

  • idea

  • #idea

  • tag:idea

  • tag:#idea

What am I missing?

Aah ok got it. Tags are currently not supported. Sorry for the misinformation.

FlorianWoelki avatar Oct 05 '23 07:10 FlorianWoelki

Seconding that this is a feature I really really need! Especially because as it is right now notes created from templates do not retain the icon.

cyanomys avatar Oct 10 '23 23:10 cyanomys

Adding my vote to this :)! In this way, icons could automatically be based on the frontmatter and iconize would be a match in heaven for people using a lot of different templates 🤝

The way I imagine it is to either support properties or have a specific property for an icon like #243, in this way the icon is note dependent on the note title.

Rhydderch avatar Oct 27 '23 09:10 Rhydderch

This is now finally released in v2.7.0.

FlorianWoelki avatar Oct 31 '23 08:10 FlorianWoelki

thank you 🙏

Rhydderch avatar Oct 31 '23 09:10 Rhydderch

I can't seem to find the correct name for the icons. I always get an error "icon not found". Any tips? :)

Alternatively, would it be possible that when we change the icon of a note through the context menu, it saves the choice in the frontmatter?

Rhydderch avatar Oct 31 '23 09:10 Rhydderch

I'm also getting the "icon not found" message. Using emojis, for example looking for the icon called "calendar"

paulwalk avatar Oct 31 '23 09:10 paulwalk

I need some sort of reproduction for that. For me the frontmatter property works as expected.

FlorianWoelki avatar Oct 31 '23 09:10 FlorianWoelki

I'm also getting the "icon not found" message. Using emojis, for example looking for the icon called "calendar"

FYI: emojis are not working atm, working on a fix. Will be probably fixed by tomorrow (see #284)

FlorianWoelki avatar Oct 31 '23 09:10 FlorianWoelki

I was able to find the correct names for the icons. The problem was that I initially didn't know the correct names for the icons as when I typed ":" to see the shortcodes, only the ones from the "icon shortcodes" plugin showed up. https://github.com/aidenlx/obsidian-icon-shortcodes

Once I uninstalled that plugin, I could finally find the correct names and the plugin indeed works as expected.

Rhydderch avatar Nov 01 '23 08:11 Rhydderch

So what is the way to add icons based on tags then?

danielo515 avatar Dec 17 '23 19:12 danielo515

So what is the way to add icons based on tags then?

---
tags: 
icon: FarSquare
---

You have to use the icon name to make it appear. Otherwise you'll get the "icon not found" error.

vsxed avatar Dec 31 '23 16:12 vsxed

Since the feature has been merged an released, i would love to turn your attention to this issue: #321

The implementation as of now is good, but not quite handy, since in order to get e.g. a todo-esque mechanism, you would need to enter the above to a note. The UX would be much better if tags would be supported correctly or otherwise if we could add aliases to icons (e.g. that icon: done would be equal to icon: FarSquare

vsxed avatar Dec 31 '23 16:12 vsxed

Just opened a PR (https://github.com/FlorianWoelki/obsidian-iconize/pull/353) to offer a way to automatically add icons based on tags using custom rules. @paulwalk @danielo515 you guys might be interested.

Here's an example rule that would match a particular tag:

icontains(this.file.tags, "#my-tag")

ngsilverman avatar Jan 17 '24 16:01 ngsilverman