Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically add icon based on tags/frontmatter #38

Closed
jurrt opened this issue Feb 8, 2022 · 22 comments
Closed

Automatically add icon based on tags/frontmatter #38

jurrt opened this issue Feb 8, 2022 · 22 comments
Labels
enhancement New feature or request

Comments

@jurrt
Copy link

jurrt commented Feb 8, 2022

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

@FlorianWoelki FlorianWoelki self-assigned this Feb 9, 2022
@FlorianWoelki
Copy link
Owner

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

@FlorianWoelki FlorianWoelki added the enhancement New feature or request label Feb 9, 2022
@stecydube
Copy link

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

@varpness
Copy link

varpness commented Apr 9, 2022

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.

@Majoramari
Copy link

This could be a great improvement to the plugin

@paulwalk
Copy link

paulwalk commented Oct 4, 2023

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 :-)

@FlorianWoelki
Copy link
Owner

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.

@paulwalk
Copy link

paulwalk commented Oct 5, 2023

@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?

@FlorianWoelki
Copy link
Owner

@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 FlorianWoelki changed the title [Suggestion] - Automatically add icon based on tags/frontmatter [FR] - Automatically add icon based on tags/frontmatter Oct 8, 2023
@FlorianWoelki FlorianWoelki changed the title [FR] - Automatically add icon based on tags/frontmatter [FR] Automatically add icon based on tags/frontmatter Oct 8, 2023
@FlorianWoelki FlorianWoelki removed their assignment Oct 8, 2023
@FlorianWoelki FlorianWoelki changed the title [FR] Automatically add icon based on tags/frontmatter Automatically add icon based on tags/frontmatter Oct 8, 2023
@cyanomys
Copy link

cyanomys commented Oct 10, 2023

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.

@Rhydderch
Copy link

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.

@FlorianWoelki
Copy link
Owner

This is now finally released in v2.7.0.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Iconize Board Oct 31, 2023
@FlorianWoelki FlorianWoelki moved this from Done to Deployed in Iconize Board Oct 31, 2023
@Rhydderch
Copy link

thank you 🙏

@Rhydderch
Copy link

Rhydderch commented Oct 31, 2023

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?

@paulwalk
Copy link

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

@FlorianWoelki
Copy link
Owner

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

@FlorianWoelki
Copy link
Owner

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)

@Rhydderch
Copy link

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.

@danielo515
Copy link

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

@vsxed
Copy link

vsxed commented Dec 31, 2023

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
Copy link

vsxed commented Dec 31, 2023

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

@ngsilverman
Copy link

Just opened a PR (#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")

@chrisgrieser
Copy link

I'm a bit confused by this. If I understand several comments in this thread correctly, this issue is about setting icon rules via tags, e.g. assign to all my files that contain the tag #done. The issue is closed, but I cannot find how to define such a rule? The custom rules appear to only work on filename or filepaths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests