Zotero Integration – Import Templates?

Wonderful! Thanks so so much

Hi again! Is there a way to link to the Zotero Item, not the attachment pdf? Say if you have added a book without a pdf attachment and want to jump to the item in Zotero :))

Also, sharing my final template for academic papers here:

---
created: 
updated: 
tags:
- 📁/📖/🟩
aliases:
- "{{title | escape}}"
course: 
lecture: 
reccomended: 
rating:
related: {% for r in relations %} 
- "[[@{{r.citekey}}]]"{% endfor %}
keywords: {% for t in tags %}
- {{t.tag | replace(r/\s+/g, "-")}}{% endfor %}
authors: [{% for a in creators %}{{a.firstName}} {{a.lastName}}{% if not loop.last %}, {% endif %} {% endfor %}]
year: '{{date | format("YYYY")}}'
citekey: "[[@{{citekey}}]]"
title: "{{title}}"
itemtype: "{{itemType}}"
journal: "{{publicationTitle}}{{publisher}}"
ISBN: {{ISBN}}
pages: {{pages}}
---
## {{title}}
- Summary:: 
- Zotero:: {{pdfZoteroLink}}
- Abstract:: {{abstractNote}}
## Highlights
{% for annotation in annotations -%} 
{%- if annotation.annotatedText -%} 
- {{annotation.annotatedText}}” [Page {{annotation.page}}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}) 
{%- endif %} 
{%- if annotation.imageRelativePath -%}
![[{{annotation.imageRelativePath}}]]{%- endif %} 
{% if annotation.comment %} 
	- {{annotation.comment}} 
{% endif %} 
{% endfor %}
## Notes

Thank you very very much for all the work you’ve put into developing and sharing this! As someone who is totally new to Obsidian, markdown, and nunjucks this was a lifesaver! I only have one question, which is probably quite a silly one, but here goes:
How do you change the icons in the headers? My annotation categories are slightly different from yours and it would be great to swap out a couple of the icons but I can’t for the life of me figure this out. Assuming it’s something quite basic but it’s beyond me. Thanks again!

Hi @sea-palm, glad you found my template useful!

Sorry for the delay in getting back. Hopefully, you’ve solved this by now.
Otherwise, you should just edit the headers in the colorValueMap variable of the latest edition of the template. In the old version you replied to, it’s just in the heading(color) macro.

1 Like

Thanks so much!

1 Like

Thank you for pointing. But it is still not clear what one should configure in the hotkeys settings?

Are you trying to set up the update button? That’s what the message you replied to is referring to. Feel free to DM me, if you need help with that.

Hi @Feralflora, thank you so much for your template and troubleshooting help!

I can’t figure one thing out though - when I import Zotero notes with your template, there are some notes that are only imported into a section called “Zotero Notes” that says it’s for notes longer than 20 words and are not imported into the Reading Notes section below. I can’t figure out where this is in the code so I can have all my notes in one place in the Reading Notes section.

I only used yellow highlighting for this PDF and it can’t be the length of the note because some of the ones that were put in the Reading Notes section as well are definitely longer than 20 words. Would appreciate any suggestions, thank you!


Hi @LostInThoughts, you’re welcome!

I guess I should have named the “Zotero notes” callout something more precise.

The notes that get stored there are these (yellow) ones attached to and pertaining to the Zotero item as a whole:

I sometimes make short overall comments in such notes, and I wanted these short comments stored up front in the frontmatter / properties. The longer notes go into the “Zotero notes” callout as nested callouts, one for each note. See the following:

image

image

If you want to change this behavior, edit line 24:
{%- set longShortCutoff = 20 -%}
and change the value to whatever you like. I believe that a 0 value should ensure that all the attached notes will then go together into the Zotero notes callout.

The annotations you make on the PDF / EPUB / snapshot go under the “Reading notes” heading. To me, this made sense because these are notes made while reading. However, you could also change this heading to “Annotations” instead to make the distinction clearer.

You are not meant to use the “Add note from annotations” option with my template and its implied workflow. This is because 1) it’s an unnecessary step, and 2) and it will lead to duplication as your annotations will then go under “Zotero notes” and “Reading notes”.

1 Like

@Feralflora Oh, I see! Thank you so much, that fixed it for me.

1 Like

Hi! I am wondering if how to add a ## Highlights title only if there is highlights into this template? Also - is there a way to link to the item, not the PDF in zotero? And if you have a book - what is the {{}} to get the amount of pages for the book? :))

- Zotero:: {{pdfZoteroLink}}
{% for annotation in annotations -%} 
{%- if annotation.annotatedText -%} 
- {{annotation.annotatedText}}” [Page {{annotation.page}}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}) 
{%- endif %} 
{%- if annotation.imageRelativePath -%}
![[{{annotation.imageRelativePath}}]]{%- endif %} 
{% if annotation.comment %} 
	- {{annotation.comment}} 
{% endif %} 
{% endfor %}

Hi @tophee and @Feralflora,
I tried to change it from the color to the colorCategory, and I still can’t get to filter properly.
Can you guys figure out what I am doing wrong? See below

coppied zotero template pdf expert.md (6.5 KB)

I love your work and the resultant template @Feralflora

How would I go about flipping the comments section, please? Ideally I’d like the highlighted text to be the first bullet and comments indented and following the highlighted text?

Thanks very much!

1 Like

I like that too, at least for the question section.

@Feralflora I forgot to mention, thank you for your work. I love it.

1 Like

Hi, espalia,
Thanks for your template. when l applied it, the color among different groups is grey,
not the red l expect. could you help me with this?

Hi @apfelstrudelig,
I am trying to figure out how you got your alias to have the author to have the et al. Can you explain it? I tried copying and pasting but can’t get the author’s name in front of the et al.

thanks,

Yeah, at least a link to the GH or Share.Note page in a separate Share&Showcase. But probably you were waiting on two-way syncing…

/I had a question here but I figured it out./

1 Like

Yeah, true. I saw the question, seems like those were bare pdfs without metadata like authors and title? The script assumes you have those. Will add handling for savages :wink: Btw, I have a support thread under #academic-tools, if you’re in the Discord server.

Discord is closed/locked there.

I solved it with if (year !== null || undefined) { by adding null (my PDFs are mostly non-Academic and foreign so I didn’t scrape for metadata, hence the lack of ‘year’).

For some reason zotero://open-pdf/library/items/<ID>?page=<number> didn’t work…
But I guess your zotero://select/library/items/<ID> is better because if the reader wants to continue on that item where they left off, the page= mode would have overruled their ‘pseudo-bookmark’ on that book, so I went back to your version. Will tinker some more with it later this week. Cheers

1 Like

Right, I have to update the link in the guide. The thread move from #academia to #academic-tools.

Thanks for the details, I will look into it.

Great, let me know how it goes. Maybe I’ll have a Share & showcase thread by then.

1 Like