How can I edit this paper template so every time I import new annotations they go under their normal section and not in a new section at the time of import

What I’m trying to do

At the moment I have zotero annotation highlights per research paper section. Ie. blue for methods, magenta for results. When I import a new paper things work perfectly. It imports a new chunk in under the “date imported annotations” or whatever it’s called. They are grouped by the time of import then by the highlighter colour. If I go back to zotero and make some new annotations it re-imports them into a new “date chunk”, so for example, I may have 2 or 3 methods sections in the notes for each time I import new notes. I dont really care when the imports were made. i would rather just group them all by highlight (potentially by date of import after that, but not necessary)

Things I have tried


title: “{{title}}”
aliases: [{% if shortTitle %}“{{shortTitle | safe}}”{% else %}“{{title | safe}}”{% endif %}]
citekey: {{citekey}}
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}}

[!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
Open DOI

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


Notes

{% macro heading(color) -%}
{%- if color == “#f19837” -%}
:dart: Aims
{%- endif -%}
{%- if color == “#e56eee” -%}
:chart_with_upwards_trend: Results
{%- endif -%}
{%- if color == “#ffd400” -%}
:bulb: General notes
{%- endif -%}
{%- if color == “#2ea8e5” -%}
:hammer: Methods
{%- endif -%}
{%- if color == “#5fb236” -%}
:link: Related references
{%- 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 color, annotations in annotations | groupby(“color”) -%}

{{heading(color)}}

{%- set isFirstAnnotation = true -%}
{%- for annotation in annotations -%}
{%- if annotation.imageRelativePath %}
![[{{annotation.imageRelativePath}}]]
{%- endif %}
{%- if annotation.comment %}
{%- if not isFirstAnnotation %}

{%- endif %}

  • {{annotation.comment}}:
    • {{annotation.annotatedText | nl2br}} (p. {{annotation.pageLabel}}) {% if annotation.hashTags %}{{annotation.hashTags}}{% endif %}
      {%- elif annotation.annotatedText %}
      {%- if not isFirstAnnotation %}

{%- endif %}

  • {{annotation.annotatedText | nl2br}} (p. {{annotation.pageLabel}}) {% if annotation.hashTags %}{{annotation.hashTags}}{% endif %}
    {%- endif -%}
    {%- set isFirstAnnotation = false -%}
    {%- endfor %}

{% endfor -%}

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