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

Custom Icon Rule based on a custom Frontmatter Field /w regex #321

Open
juicybox opened this issue Dec 6, 2023 · 1 comment
Open

Custom Icon Rule based on a custom Frontmatter Field /w regex #321

juicybox opened this issue Dec 6, 2023 · 1 comment

Comments

@juicybox
Copy link

juicybox commented Dec 6, 2023

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:

  1. If you're already using the icon-Property for other purposes or own UseCases.
    1. Like using the icon Property for your own purpose.
    2. The property is already claimed by a plugin like "metadatamenu"
    3. 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.

Screenshot - 2023-12-06 22 26 26

Related:

  1. Automatically add icon based on tags/frontmatter #38
  2. https://github.com/noatpad/obsidian-banners
  3. 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:

  1. 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.
  2. 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.

Screenshot - 2023-12-06 22 52 54

Related:

  1. Automatically add icon based on tags/frontmatter #38 (comment)
  2. 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.

Screenshot - 2023-12-06 22 23 26

Use Case 2

The ability to choise between:

  1. File or Path (like implemented)
  2. An own frontmatter filed with regex or string
  3. A tag with regex or string (like first match in tag list, or ideally you're using only one tag per note)

Screenshot - 2023-12-06 22 45 39

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:

  1. https://github.com/mdelobelle/obsidian_supercharged_links
@ngsilverman
Copy link

I just opened a PR (#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))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants