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

[FR]: Copy tags improvement: Add the ability to copy dataview simple values to tags #26

Closed
2 tasks done
yshalsager opened this issue Aug 28, 2022 · 13 comments
Closed
2 tasks done
Assignees
Labels
✨ Enhancement New feature or request

Comments

@yshalsager
Copy link

yshalsager commented Aug 28, 2022

Issue validation

Workflow

Obsidian plugin 💠

Is your feature related to a problem ?

No response

What solution do you want to see ?

Some people heavily depends on dataview annotations for categorizing topics instead of tags. I think a super useful addition would be having the ability to copy pre-defined dataview inline fields link text value(s).

For example, if I have the page with the following:

---  
created: 2021-12-28 00:00  
updated: 2021-12-28 00:00  
title: youtube-dl download subtitle only  
share: true  
website: en/notes  
---  
  
# youtube-dl download subtitle only  
  
Status:: #notes/archives  
Link: <https://superuser.com/a/927532>  
Knowledge:: [Linux](Linux), [Tools](Tools),

By setting Knowledge as the field to be copied, the processed note should have:

tags:
  - Linux
  - Tools

Describe the alternative you've considered

No response

OS

Linux

Anything else?

  • The option should be able to handle having single or multiple dataview link objects, because as far as I know it can be Link or Array.
@yshalsager yshalsager added the ✨ Enhancement New feature or request label Aug 28, 2022
@Mara-Li
Copy link
Member

Mara-Li commented Aug 28, 2022

I think this suggestion is irrelevant for the plugin. It needs to handle too much parameters/regex. If you need to add tags to your note with using dataview, just edit it with using templater/quick add.

@yshalsager
Copy link
Author

I think this suggestion is irrelevant for the plugin. It needs to handle too much parameters/regex. If you need to add tags to your note with using dataview, just edit it with using templater/quick add.

Hmm, shouldn't it be easy enough to utilize dataview API to do this instead of relying on regex?

{
    ...
    "created": "2021-12-28 00:00",
    "updated": "2021-12-28 00:00",
    "title": "youtube-dl download subtitle only",
    "share": true,
    "website": "en/notes",
    "status": "#notes/archives",
    "knowledge": { // Link
        "path": "Linux.md",
        "type": "file",
        "embed": false
    }
}

@Mara-Li
Copy link
Member

Mara-Li commented Aug 28, 2022

How can you notice that the knowledge is a link, tag, string, list... TBH i don't think it's useful/relevant in the purpose of the plugin?

@yshalsager
Copy link
Author

How can you notice that the knowledge is a link, tag, string, list... TBH i don't think it's useful/relevant in the purpose of the plugin?

Simply by checking typeof?

  • link => use its text.
  • string => use as is.
  • tag => use without spaces or slashes.
  • array => deal with each as previous.

The point of my suggestion is to improve reachability of content on platforms like Hugo by appending certain DV inline fields to tags, since inline fields are useless outside obsidian. So, it's kind of sub-feature of inline tags to tags feature.

Honestly, I think it's relevant to the plugin note content process part.

@Mara-Li
Copy link
Member

Mara-Li commented Aug 28, 2022

But you could add the tags directly using templater ?

@yshalsager
Copy link
Author

But you could add the tags directly using templater ?

That's totally possible, but this approach will have some problems in my opinion:

  • It will pollute tags for someone that heavily depends on dataview annotations for categorizing topics instead of tags.
  • It works only well when I already know where does this note belong.
  • The tag be always added to the note.

@Mara-Li
Copy link
Member

Mara-Li commented Aug 28, 2022

For me, dataview is not designed to be published. I don't want to add theses option because it will polute more and more the settings, as I need to add :

  • Textaera to get the field
  • Add a way to exclude value
  • Call dataview API to get the internal field
  • Check every value of the choosen fields, as string, link, or array
  • Get only the string part as an array, filter the list with excluded value
  • Modify again the frontmatter with parseYaml and stringify.

This will add more and more options to just set tags based on dataview value...

@Mara-Li
Copy link
Member

Mara-Li commented Aug 28, 2022

Hmmm, after summarize this, finally i think it can be usefull throught Publisher.

Do you have the dataview function to get inline metadata ?

@yshalsager
Copy link
Author

Hmmm, after summarize this, finally i think it can be usefull throught Publisher.

Do you have the dataview function to get inline metadata ?

No idea if there's such function to get only inline metadata, but I think there's no need to filter only inline, as the workflow can simply go like: values from users and access value directly using dataview.page("current page path")[key]

@Mara-Li
Copy link
Member

Mara-Li commented Aug 28, 2022

I updated in beta (to try this time ;) the plugin ! Could you please try / beta test this function ? :)

@yshalsager
Copy link
Author

yshalsager commented Aug 28, 2022

I updated in beta (to try this time ;) the plugin ! Could you please try / beta test this function ? :)

Awesome!

Just gave it a try, works well with single or multiple links values, but apparently it removes other tags copied by inline to tags feature by mistake?
Here's an example

@Mara-Li
Copy link
Member

Mara-Li commented Aug 28, 2022

Thanks you for this reply and bug issue ! I fixed it :)
Could you please try the last update ? :)

@Mara-Li Mara-Li reopened this Aug 28, 2022
@yshalsager
Copy link
Author

Thanks you for this reply and bug issue ! I fixed it :) Could you please try the last update ? :)

Thanks for the quick fix! Works perfectly now.

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
None yet
Development

No branches or pull requests

2 participants