Zotero Integration – Import Templates?

Here’s my template, inspired by @mgmeyers and @erazlogo. However, I only use callouts for the info and the abstract. The annotations and comments are formatted as a bullet list, where comments are listed in bold before the highlight they belong to, which is indented below and highlighted using ==highlight==. If a highlight has tags, those are listed next to the highlight.

EDIT: A new and improved version of this template is available here: Zotero Integration – Import Templates? - #105 by Feralflora

The annotations are grouped by color under different headings.

---
citekey: {{citekey}}
aliases: [{% if shortTitle %}"{{shortTitle | safe}}"{% else %}"{{title | safe}}"{% endif %}]
title: "{{title}}"
authors: {{authors}}
tags: [literature-note, {% for t in tags %}{{t.tag}}{% if not loop.last %}, {% endif %}{% endfor %}]
year: {{date | format("YYYY")}}
publisher: "{{publicationTitle}}"
doi: {{DOI}}
---

# [{{title}}]({{desktopURI}})

> [!info]+
>{% if bibliography %}**Bibliography:** {{bibliography}}{% endif %}
>
>**Page-no:** {% for annotation in annotations %}{% if loop.first %}{{annotation.pageLabel}}{% endif %}{% endfor %}
>
>{% if hashTags %}**Tags:** {{hashTags}}{% endif %}
>
>{%- for attachment in attachments | filterby("path", "endswith", ".pdf") %}**PDF:** [{{attachment.title}}](file:///{{attachment.path | replace(" ", "%20")}}){%- endfor %}
>
>[**Open in Zotero**]({{desktopURI}})
>[**Open DOI**](https://doi.org/{{DOI}})

> [!abstract]-
> {% if abstractNote %}
> {{abstractNote|replace("\n"," ")}}
> {% endif %}
 
---

## Notes
{% macro heading(color) -%}
{%- if color == "#5fb236" -%}
💡 Main ideas, contributions and conclusions
{%- endif -%}
{%- if color == "#2ea8e5" -%}
❔ Questions
{%- endif -%}
{%- if color == "#ffd400" -%}
⭐ Important
{%- endif -%}
{%- if color == "#a28ae5" -%}
🧩 Definitions and concepts
{%- endif -%}
{%- if color == "#ff6666" -%}
⛔ Weaknesses and caveats
{%- endif -%}
{%- endmacro -%}


{% persist "annotations" %}
{% set annotations = annotations | filterby("date", "dateafter", lastImportDate) -%}
{% if annotations.length > 0 %}

*Imported on {{importDate | format("YYYY-MM-DD HH:mm")}}*

{% for color, annotations in annotations | groupby("color") -%}

### {{heading(color)}}

{%- for annotation in annotations -%}
{%- if annotation.imageRelativePath %}
![[{{annotation.imageRelativePath}}]]
{%- endif %}
{%- if annotation.comment %}
- **{{annotation.comment}}:**
	- =={{annotation.annotatedText | nl2br}}== [(p. {{annotation.pageLabel}})](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.pageLabel}}&annotation={{annotation.id}}) {% if annotation.hashTags %}{{annotation.hashTags}}{% endif %}
{%- elif annotation.annotatedText %}
- =={{annotation.annotatedText | nl2br}}== [(p. {{annotation.pageLabel}})](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.pageLabel}}&annotation={{annotation.id}}) {% if annotation.hashTags %}{{annotation.hashTags}}{% endif %}
{%- endif -%}{%- endfor %}

{% endfor -%}
{% endif %}
{% endpersist %}

{{abstractNote|replace("\n"," ")}} The replace filter ensures that the abstract stays within the callout even though it may have linebreaks in Zotero. Structured abstracts with headings tend to cause this issue. The workaround is achieved by replacing linebreaks with a single space.

Screenshots

Info and abstract:

Comments and their nested highlights, with tags:

Folded headings

Theme

If someone is curious, the theme I am using in the screenshots is the Polka theme.

11 Likes