obsidian-iconize
obsidian-iconize copied to clipboard
Custom Icon Rule based on a custom Frontmatter Field /w regex
Is your feature request related to a problem? Please describe.
It is great to have the ability to use the icon
Property on a file-based setting, but..
UseCase 1: Ability to configure an own Property for filebased Icons
But I might see some issue or side effects within an existing vault and notes:
- If you're already using the icon-Property for other purposes or own UseCases.
- Like using the icon Property for your own purpose.
- The property is already claimed by a plugin like "metadatamenu"
- Or I would like to use a different property for that UseCase, like image or iconImage, etc..
Take a look at other plugins like obsidian-banners Plugin, where you can set up a custom Property or a prefix for the banner Icon.
Related:
- https://github.com/FlorianWoelki/obsidian-iconize/issues/38
- https://github.com/noatpad/obsidian-banners
- https://github.com/mdelobelle/metadatamenu
UseCase 2: Using Custom Icon Rules on own defined Frontmatter Fields or Tags
Like @ReedWriter mentioned, I think this is still an issue to have less work with defined icons on files.
Like with the already possible option to define regex or string patterns on files or paths.
The Problem I see:
- If you would like to change an Icon for a specific type, you might need to change all files, and replace the value of the
icon
frontmatter field. - It is not always possible to group the same types of files in a folder (inherited icons on folder)
I consider the regex or string match by the Custom Icon Role setting is still the ideal solution, but would be great to be enhanced on fromatter fileds.
Take a look at Auto Note Mover Plugin, it uses a similar strategy.
Related:
- https://github.com/FlorianWoelki/obsidian-iconize/issues/38#issue-1127805466
- https://github.com/farux/obsidian-auto-note-mover
Describe the solution you'd like
UseCase 1
Ideally, you can set up the property filed name by your own, which fits in your own naming convention in the settings dialog.
Use Case 2
The ability to choise between:
- File or Path (like implemented)
- An own frontmatter filed with regex or string
- A tag with regex or string (like first match in tag list, or ideally you're using only one tag per note)
Sidenote: My current workflow is, as you might see in the screenshot, is using Wikipedia like file naming.
Describe alternatives you've considered
- Switching back, and keep using Supercharged Links Plugin, but with more handwork and maintenance
Related:
- https://github.com/mdelobelle/obsidian_supercharged_links
I just opened a PR (https://github.com/FlorianWoelki/obsidian-iconize/pull/353) that would make it possible to write rules based on file properties (aka. Frontmatter) or tags (among other things).
So for example, looking at your use case 2, you could write the following rules:
If the icon
file property matches a given regex
regextest("your regex", this.icon)
If a tag in the file matches a given regex
this.file.tags and any(this.file.tags, (t) => regextest("your regex", t))