willasm / obsidian-open-weather

Obsidian plugin for OpenWeather API
MIT License
44 stars 2 forks source link

Inserting weather upon file creation issue #26

Closed angiioh closed 3 months ago

angiioh commented 3 months ago

Hi! I've recently been getting into Obsidian and I've been really appreciating your plugin. However, as I've come to be more familiar with Obsidian, I've been trying to spruce up my Daily Notes by adding a template.

I have %weather1% in the top of my Daily Note template, but when I create a new note, it's not actually getting replaced. I'm able to manually do it through commands, but from what I've read in your guide, it sounds like it should be replacing itself automatically.

image

Any ideas? Thanks so much.

willasm commented 3 months ago

It appears you have written %weatherI% with a capital 'I' instead of a one '1'. Can you verify this for me please.

angiioh commented 3 months ago

Yeah, that's just the font. If I manually replace the string, it replaces it correctly as well. Definitely a 1 and not an i

willasm commented 3 months ago

Strange. Yes it should be replaced. This is a template for your daily notes I assume. Exactly how are you creating the daily note, from the command pallet or the daily note button on the left side of Obsidian?

angiioh commented 3 months ago

Gotcha. I was using the Daily Note button on the left side up until today because now I'm using Periodic Notes instead. (Same thing happens with both though) Additionally, I am using Templater instead of the core plugin Templates. Could that be the reason why?

willasm commented 3 months ago

It should work by either method of creating the daily note. I have never tried periodic notes, but I do use templater without any issues. Can you try the templater command Create new note from template from the command pallet and select your template for your daily note and see if it gets replaced then.

angiioh commented 3 months ago

Okay, weird. And sure, I just tried that and got the same result, unfortunately.

willasm commented 3 months ago

Hmm, it definitely should work that way. Can you create a new template, name it whatever you want and set the files contents to this...

"Weather: %weather1%"

Without the quotes (use copy/paste) and then try the same templater command again. That should definitely work and I just tested this. You said it was failing before you started using periodic notes as well? If so, then that is not likely the cause.

angiioh commented 3 months ago

Okay, I copy/pasted the text from within the quotes into a new template and then used the templater command to create a new note from a template. It did not work for me.

And yes, it was failing before switching to periodic notes.

angiioh commented 3 months ago

I can make a screen recording if you think that would be helpful.

willasm commented 3 months ago

Can you check one more thing first. In the extensions settings check if the Exclude folder has been set to any of the vaults folders. That would prevent it working if it is set to the folder your note is being created in.

angiioh commented 3 months ago

The dropdown option for that setting is blank. I don't think I've even clicked it before now.

willasm commented 3 months ago

That has to be it then. Create a folder named Templates and move your templates in there. The templater plugin and the built in templates addin actually require you to set a folder location for your templates. Do that and try it again.

angiioh commented 3 months ago

Ohh, I see. I did already have my templates in a folder, but didn't select that folder to be excluded from the automatic string replacement. I didn't make the connection that I was supposed to pick my templates folder 🙃 I picked my templates folder and tried again and it's working! I really appreciate your time helping me troubleshoot this.

angiioh commented 3 months ago

I see that instruction is in your docs and I must have glossed over it because I wasn't using templates yet when I added your plugin. Thank you again!

willasm commented 3 months ago

Sounds great! Just wish the idea would have occurred to me sooner, lol. If you have any more issues just let me know.