Zotero is a fantastic open-source reference manager that I’ve been using and blogging about since 2011.

Until the recent and sudden shutdown of the Omnivore read-it-later app, I was using it mostly for academic publications, but now I have started using its recently revamped (Zotero 7 is great!) web page archiving and highlighting (annotation) capabilities also for web references.

In this post, I am sharing my import template for the Zotero Integration plugin for Obsidian with which you can import any reference, along with its highlights, into your Obsidian vault.

The goal

At the press of a button, you can create or update an Obsidian note which looks like this:

Example of imported academic publication with highlights. Study shows that dark mode is worse.

Example of imported academic publication with highlights. Study shows that dark mode is worse.

… or like this:

Example of imported web page. Spark shuffle partitions can kill your performance.

Example of imported web page. Spark shuffle partitions can kill your performance.

The template

Templates for the Obsidian Integration plugin use the Nunjucks template language. On the right of the screenshots above, you can see the Zotero Data Explorer which shows all of the variables that are available for a particular reference, which is super useful when you’re fine-tuning the template.

After installing the plugin in Obsidian, create a template .md file anywhere in your vault, add the contents below, and then reference that file in the “import format” you create in the plugin settings panel. Read more in the Obsidian Integration Template docs.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: "{{title}}"
{% if date %}year: {{date | format("YYYY")}}{% endif %}
authors: {{authors}}{{directors}}
tags: 
  - zotero 
---

{{ bibliography }}

- zotero: [{{desktopURI}}]({{desktopURI}})
- url: {{url}}
{% if pdfLink -%}
- pdf: {{pdfLink}}
{%- endif -%}

{% if abstractNote %}
# Abstract
{{ abstractNote }}
{% endif %}

# Highlights

{% for annotation in annotations %}
{% if annotation.annotatedText %}
> [!cite]
> {{annotation.annotatedText}}
> [Page {{annotation.page}}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}})
{%- if annotation.comment %} {# comment along with highlighted text #}
> > [!note]
> > {{annotation.comment}}
{% endif %}
{% else %}
{% if annotation.comment %} {# standalone comment, no text! #}
> [!note]
> {{annotation.comment}}
> [Page {{annotation.page}}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}})
{% endif -%}
{% endif -%}
{% if annotation.imageRelativePath %}
![[{{annotation.imageRelativePath}}]]
{% endif -%}
{% endfor %}

# Notes
{% persist "notes" %}
{% endpersist %}