Template Generated Links from Obsidian to Zotero Annotations Not Working

Hello,

I’ve spent the better part of the day getting a template I like set up using Zotero Integration for migrating my Zotero highlights into an Obsidian note. I’m very new to this kind of coding, but I’ve got mostly everything working to my liking. However, I cannot get links to my Zotero pdfs to function properly from inside Obsidian.

I found the following snippet of code online that suggests my template should auto-generate a link to the correct page for my annotation. When I click the link, it just opens to the last state Zotero was in - It doesn’t even pull up the appropriate pdf, let alone the specific page where the annotation can be found.

([p. {{annot.pageLabel}}](zotero://open-pdf/library/items/{{annot.attachment.itemKey}}?page={{annot.pageLabel}}&annotation={{annot.id}}))

When I run the template to import from Zotero, it’ll create something like this, based on the annotations in the document:

([p. 3](zotero://open-pdf/library/items/MADWUYS8?page=3&annotation=YQR6C5XE))

Based on what I’ve found online, I’m stumped as the why the link isn’t working. Any help for fixing this would be much appreciated!

Welp. Answered my own question, but probably worth mentioning it here. The file I was working with was stored in a Zotero Group Library. The code works just fine for files stored in “My Library.”

I figured this out by manually dragging the annotation into Obsidian, which provided a linked filepath, which looked like this:

[pdf](zotero://open-pdf/groups/4884667/items/MADWUYS8?page=3&annotation=G8QX767E)

Having the /groups/4884667/ added in place of /library/ fixed the broken link.

I don’t have a clue how to code it to be smart enough to know if I’m pulling from a group library. Fortunately, nothing I plan on working with is in that Group space - I was just using it as a sandbox for figuring out my template.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.