LostPaul / obsidian-folder-notes

Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.
https://lostpaul.github.io/obsidian-folder-notes/
GNU Affero General Public License v3.0
264 stars 11 forks source link

Folder name based on its note YAML data #8

Closed mdSlash closed 11 months ago

mdSlash commented 1 year ago

Hi! Thanks for this awesome plugin. Could you add a feature to change the folder name based on its note YAML data, such as the title or alias?

dljsjr commented 1 year ago

+1 to this; I append UUIDs to all of my file names but I use https://github.com/snezhig/obsidian-front-matter-title to keep them from rendering the UUID portion in the file tree.

The Front Matter Title author has an NPM package that provides an API in to the plugin's configuration, so maybe including that and then trying to detect if Front Matter Title is being used could be a way forward? https://github.com/Snezhig/front-matter-plguin-api-provider

pm64 commented 1 year ago

Just wanted to add my +1 here. This plugin and https://github.com/snezhig/obsidian-front-matter-title both provide crucial functionality, would be incredible if they could work together.

LostPaul commented 1 year ago

Oops I misclicked, I'll do this somewhen when I've enough time

pm64 commented 1 year ago

But I already popped the champagne!

snezhig commented 1 year ago

I have just updated the package which provides api for my plugin

pm64 commented 1 year ago

@LostPaul - the emergence of @snezhig's new API should simplify this enhancement substantially, I hope you'll consider it for a future update. Thanks for all you do.

merrkry commented 12 months ago

Would absolutely be amazing if they work together!

dljsjr commented 11 months ago

I believe this has been released in 1.4.2! There's a new option in the settings for the extension where you can enable integration with https://github.com/snezhig/obsidian-front-matter-title!

LostPaul commented 11 months ago

I believe this has been released in 1.4.2! There's a new option in the settings for the extension where you can enable integration with https://github.com/snezhig/obsidian-front-matter-title!

Yeah I was writing the release notes after I released but then I found one bug and didn't have enough time to fix it until now I'll finish the release notes when the bug has been fixed.

pm64 commented 11 months ago

@LostPaul, immensely grateful for your latest update featuring frontmatter title integration.

In exploring Obsidian's new "Properties" feature, I may have found a small bug in your integration. I already ran this past @snezhig to make sure it wasn't an API issue before posting here (see https://github.com/snezhig/obsidian-front-matter-title/issues/107).

Basically what I'm experiencing is that when Obsidian loads, if there is a folder note with YAML that specifies an alternate title, the folder is still displayed with its actual title.

If you then disable frontmatter title integration in your plugin's settings, then re-enable it, the folder's title changes, and is now displayed according to the folder note's YAML, as expected.

In my test case, the title is specified in the YAML using an array named "aliases". This is a single-element array, and the frontmatter title plugin correctly uses the value of its first and only element as the title.

"Aliases" is a frontmatter key that gets special treatment by Obsidian under the new Properties feature:

image

I didn't do any further testing to determine if this issue is specific to the "aliases" key, or if frontmatter titles are affected across the board. But happy to do any additional research/troubleshooting that might help resolve this.

LostPaul commented 11 months ago

It works for me

https://github.com/LostPaul/obsidian-folder-notes/assets/70213368/8162e868-5686-4ec8-9f5f-a4f6c63f5f48

pm64 commented 11 months ago

It works for me too @LostPaul, but only after disabling & re-enabling the integration...

Obsidian_JOtrz0cnLJ

There must be a simple explanation, maybe a difference in our plugin settings?

mdSlash commented 11 months ago

Sorry for the misunderstanding. I'm using a UID for my notes – e.g., a note has the name "202307301753" This means I can't name the folder like that because it will be hard to read the path, etc. My point is that the folder should be merged with the note that has the same title metadata as the folder name.

Thanks @LostPaul for your time.

LostPaul commented 11 months ago

Sorry for the misunderstanding. I'm using a UID for my notes – e.g., a note has the name "202307301753" This means I can't name the folder like that because it will be hard to read the path, etc. My point is that the folder should be merged with the note that has the same title metadata as the folder name.

Thanks @LostPaul for your time.

Wdym with "merged"

mdSlash commented 11 months ago

the folder and the note to be integrated into one, similar to Notion

LostPaul commented 11 months ago

also where would you read the path? "name the folder like that because it will be hard to read the path"

mdSlash commented 11 months ago

It will be hard if I name the folder like the note name, as the path will be like "202.../202.../202...xx.md," and it can't be read from quick switcher or note suggester.

pm64 commented 11 months ago

@LostPaul, I'm still hoping to account for the issue I'm having with the new frontmatter title integration and Properties feature. Specifically, why does it work for you without the need to disable/re-enable the integration, as I must do?

I know I'm reaching here, but maybe your plugin caches data somewhere that I haven't noticed? And if so, perhaps this data is corrupted in my vault?

Or -- I only have the 2 plugins installed (your folder notes plugin, and the frontmatter title plugin). Is it possible you have a 3rd plugin installed that is somehow causing it to work for you (for example, by affecting the initialization timing)?

This integration closes a critical gap for me, really dying to use it.

LostPaul commented 11 months ago

@LostPaul, I'm still hoping to account for the issue I'm having with the new frontmatter title integration and Properties feature. Specifically, why does it work for you without the need to disable/re-enable the integration, as I must do?

I know I'm reaching here, but maybe your plugin caches data somewhere that I haven't noticed? And if so, perhaps this data is corrupted in my vault?

Or -- I only have the 2 plugins installed (your folder notes plugin, and the frontmatter title plugin). Is it possible you have a 3rd plugin installed that is somehow causing it to work for you (for example, by affecting the initialization timing)?

This integration closes a critical gap for me, really dying to use it.

Not sure why that happens but might have solution for it but could you first look in the console if you get any error messages?

pm64 commented 11 months ago

@LostPaul, yes Indeed! Here's what I've got:

caught (in promise) Error: Plugin obsidian-front-matter-title-plugin is not enabled or old version
    at getDefer2 (plugin:folder-notes:97:15)
    at eval (plugin:folder-notes:2569:74)
    at new FrontMatterTitlePluginHandler (plugin:folder-notes:2597:7)
    at FolderNotesPlugin.onload (plugin:folder-notes:3899:26)

I have the latest build of obsidian-front-matter-title-plugin enabled, so this does seem to suggest a timing issue.

LostPaul commented 11 months ago

@MDslash Could you add me on discord so you can explain your workflow a bit better without interrupting the conversations about issues due to this feature request? My name on discord is "lostpaul".

LostPaul commented 11 months ago

@LostPaul, yes Indeed! Here's what I've got:

caught (in promise) Error: Plugin obsidian-front-matter-title-plugin is not enabled or old version
    at getDefer2 (plugin:folder-notes:97:15)
    at eval (plugin:folder-notes:2569:74)
    at new FrontMatterTitlePluginHandler (plugin:folder-notes:2597:7)
    at FolderNotesPlugin.onload (plugin:folder-notes:3899:26)

I have the latest build of obsidian-front-matter-title-plugin enabled, so this does seem to suggest a timing issue.

Does this main.js file work for you? https://github.com/LostPaul/obsidian-folder-notes/blob/test-branch/main.js

pm64 commented 11 months ago

Yes @LostPaul - I can confirm that this update DOES resolve the issue for me.

LostPaul commented 11 months ago

Yes @LostPaul - I can confirm that this update DOES resolve the issue for me.

Does it also work for you with the newest plugin release?

pm64 commented 11 months ago

Confirmed! Works perfectly. Thank you @LostPaul.