mgmeyers / obsidian-zotero-integration

Insert and import citations, bibliographies, notes, and PDF annotations from Zotero into Obsidian.
GNU General Public License v3.0
1.06k stars 55 forks source link

Prevent Overwrite if File of the Same Name Exists #201

Open davepivonka opened 1 year ago

davepivonka commented 1 year ago

Hello,

I have recently switched from Citations to Zotero Integration. However, I was not aware that Z.I. automatically overwrites any existing notes. I have found the persist tag, but since my older notes do not include it, I have already accidentally overwritten multiple of them. Is it possible to completely prevent any existing files from being overwritten?

Thank you :) ... and sorry if I missed it in the documentation haha

zhuoqun-chen commented 1 year ago

Hello,

I have recently switched from Citations to Zotero Integration. However, I was not aware that Z.I. automatically overwrites any existing notes. I have found the persist tag, but since my older notes do not include it, I have already accidentally overwritten multiple of them. Is it possible to completely prevent any existing files from being overwritten?

Thank you :) ... and sorry if I missed it in the documentation haha

Hi davepivonka, may I ask where should I add persist tag to avoid already existed annotations from being overwritten?

I created some notes, but when I tried to update new notes from zotero, the old page was overwritten and also lost some notes.

ryanwwest commented 1 year ago

I'm curious specifically how to add the persist tag to the template such that the YAML frontmatter stays the same (after it has been generated during the initial import), as I make a few changes to the YAML like a rating: 9 key that get overwritten when resyncing to fetch additional annotations.

FeralFlora commented 7 months ago

I'm curious specifically how to add the persist tag to the template such that the YAML frontmatter stays the same (after it has been generated during the initial import), as I make a few changes to the YAML like a rating: 9 key that get overwritten when resyncing to fetch additional annotations.

You can't do that, as the persist comment will break the YAML, so it will not be recognized anymore. My workaround is to use Dataview metadata fields to these types of metadata that I want to change in Obsidian. These dataview fields are then stored in a persistent field in the note.

FeralFlora commented 7 months ago

I have found the persist tag, but since my older notes do not include it

You should be able to add persistent fields to existing notes like so:

%% begin annotations %%

< Your existing annotations >

%% end annotations %%

While also adding the persistent field to your template.

{% persist "annotations" %}

< Your annotation formatting code >

{% endpersist %}
danieltomasz commented 7 months ago

Hi @FeralFlora I recently experimented with plugin projects, for a short moment I was thinking that I found ideal way to automatically process my papers to in the kanban form, then I remembered that Zotero Integration will overwrite all my changes, and Projects doesn't accept properties included in the body of the file :(

edited later:Actually I wasn't right, I can have read-only automated kanban board when I use dataview import - but this is off-topic :)

FeralFlora commented 7 months ago

Actually I wasn't right, I can have read-only automated kanban board when I use dataview import - but this is off-topic

I'm glad you found a workaround using the Dataview import / source for the Project. Personally, I also tried using Projects to manage my reading, but since I also wanted to plan my reading of items I had yet to import, I ended up making this script that imports item into a Kanban plugin kanban board, based on tags in Zotero: https://share.note.sx/e612da498b038c3e5e367043782e2b59