What I’m trying to do
I am using a Zotero import template from Danny Hatcher that I like very much. I would like to add a persistent notes section, where I Can add my own thoughts, and not have them disappear whenever I update the same reference from Zotero in the future.
Things I have tried
I have tried adding the following text to the template. When I import from Zotero for the first time, this works fine. However, if I add text to the persistent notes section, and try and re-import from Zotero, the new persistent note stays, but all of the notes imported from Zotero disappear.
Does anyone have advice on how I can fix this bug?
Here is the template:
Title: {{title}}
Tags: {{hashTags}}
Authors: {{authors}}
Zotero link: {{pdfZoteroLink}}
Persistent Notes
{% persist “notes” %}{% if isFirstImport %}
Write notes here!
{% endif %}
{% endpersist %}
In-text annotations
{%-
set zoteroColors = {
“#2ea8e5”: “blue”,
“#5fb236”: “green”,
“#a28ae5”: “purple”,
“#ff6666”: “red”,
“#ffd400”: “yellow”,
“#f19837”: “orange”,
“#aaaaaa”: “grey”,
“#e56eee”: “magenta”
}
-%}
{%-
set colorHeading = {
“blue”: “Blue
Ideas to develop”,
“green”: “Green”,
“purple”: “Purple”,
“red”: “Red”,
“yellow”: “Yellow
Key quotes”,
“orange”: “Orange
”,
“grey”: “Grey”,
“magenta”: “Magenta”
}
-%}
{%- macro calloutHeader(type) -%}
{%- switch type -%}
{%- case “highlight” -%}
Highlight
{%- case “image” -%}
Image
{%- default -%}
Note
{%- endswitch -%}
{%- endmacro %}
{%- set newAnnot = [] -%}
{%- set newAnnotations = [] -%}
{%- set annotations = annotations | filterby(“date”, “dateafter”, lastImportDate) %}
{%- for annot in annotations -%}
{%- if annot.color in zoteroColors -%}
{%- set customColor = zoteroColors[annot.color] -%}
{%- elif annot.colorCategory|lower in colorHeading -%}
{%- set customColor = annot.colorCategory|lower -%}
{%- else -%}
{%- set customColor = “other” -%}
{%- endif -%}
{%- set newAnnotations = (newAnnotations.push({“annotation”: annot, “customColor”: customColor}), newAnnotations) -%}
{%- endfor -%}
{%- for color, heading in colorHeading -%}
{%- for entry in newAnnotations | filterby (“customColor”, “startswith”, color) -%}
{%- set annot = entry.annotation -%}
{%- if entry and loop.first %}
{{colorHeading[color]}}
{%- endif %}
{{calloutHeader(annot.type)}} (Page {{annot.page}})
{%- if annot.annotatedText %}
{{annot.annotatedText}} {% if annot.hashTags %}{{annot.hashTags}}{% endif -%}
{%- endif %}
{%- if annot.imageRelativePath %}
{{annot.imageRelativePath}}
{%- endif %}
{%- if annot.ocrText %}
{{annot.ocrText}}
{%- endif %}
{%- if annot.comment %}
- {{annot.comment}}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}