snezhig / obsidian-front-matter-title

Plugin for Obsidian.md
GNU General Public License v3.0
236 stars 19 forks source link

Dataview variables break file rename #24

Closed Exomancer closed 2 years ago

Exomancer commented 2 years ago

I have a file with two dataview variables in the YMAL frontmatter. The file retained it's 12 digit Zettelkasten file name and would not display the file name from the YMAL front matter variable. When I moved the Dataview variables out of the YMAL section, the plugin worked and renamed the file as it was supposed to do. The Dataview variables have nothing to do with this plugin that I can see and are not even close as far as variable names. They were there to create a date in the document.

Installed plugin version 1.4.1 Obsidian 1.2.2 (56) API 0.14.15 (Android)

snezhig commented 2 years ago

Hi!

Could you add any examples, screenshots or a record? I'm not sure that I understand what dataview variable means.

Thank you for the feedback.

Exomancer commented 2 years ago

The YMAL is:

---
filename: Obsidian Dataview Date Math
tags:
doy:: `=dateformat(date(today), "ooo")`
dsvg:: `=3760/365`
---

The "filename" variable is to rename the document The "doy" and "dsvg" are the dataview variables. With them inside the YMAL as above, the filename will not be used by your plugin.

If I move them outside the YMAL your plugin works.

I also noticed that if I use an alias like so:

---
filename: Obsidian Dataview Date Math
alias: [Obsidian Dataview Date Math]
---

and forget one of the brackets like so:

---
filename: Obsidian Dataview Date Math
alias: [Obsidian Dataview Date Math
---

the filename will not be renamed.

snezhig commented 2 years ago

Thank you for the examples. I guess that Obsidian does not return a valid fronmatter because it can not parse your yaml section. It seems broken. But I will check it and give you the answer.

snezhig commented 2 years ago

Yes, I checked this and Obsidian's MetaDataCache just does not contains frontmatter key for files with your examples of yaml section. But I will look at option to have a possibility to get the data in another way.

Exomancer commented 2 years ago

It could be me. I'm new to Databiew and that looked like how the variables are put in. I could be wrong/ However I just think it's a point that something in the YMAL broke the ability of your plugin to rename the files.

snezhig commented 2 years ago

You can try this to valid your yaml: http://www.yamllint.com/ If yaml is not correct, obsidian does not cache it and my plugin have nothing to work with.

Exomancer commented 2 years ago

Thank you. The backticks in the Dataview variables was making the YMAL invalid. I got that syntax from a post on Databiew.

snezhig commented 2 years ago

So can we close this issue or you have some questions?

Exomancer commented 2 years ago

Well I assume alias syntax errors do the same thing so yes you can close the issue.