Zotero Integration issue - copies colored tags to note title

So the Zotero Integration plugin copies colored tags to the note title, which is a big problem that interferes with importing and updating existing items.

In my case, those are emoji tags. So the note title always has a bunch of emojis at the start of the title even though they’re not in the actual item’s {{title}} in Zotero/bibtex. I’m unable to disable the copying of these tags because they don’t seem to be attached to any one field and the plugin seems to be pulling them in somehow.

So in the pugin settings no matter what i put for the note title e.g. {{citekey}}, it still copies the “colored” (shortcut 1-9) zotero tags into the note title. There is seemingly no way to disable it.

I have posted on the github for support but there is no response.

This is a big problem because those tags in zotero are not only often changed and updated but zotero itself doesnt seem to order them in a consistent way from one day to the next. So when you try to re-import a litereature note, instead of updating / overwriting it, it produces an entirely new note for the sole reason that its tags are in a random different order chosen by zotero or that the tags have been changed by the user

I much prefer the Zotero Integration implementation instead of “Zotlit” or similar plugins for various reasons, in particular becuse I have spent a lot of time working on my lit note template, and other than the note title itself it’s exactly what I need, and I do not wish to switch to a completely different method.

This sounds very strange. What’s your citekey format in Better Bibtex’s settings? Can you copy-paste it here?

It would also be useful to see your full template and a screenshot of your import settings.

1 Like

citeky format:

authEtal2.fold + “.” + year + “.” + shorttitle(4,4)

full template:


aliases:
title: “{{title}}”
authors: {{“”}}{%- if authors -%}
{%- for author in authors -%}
{{author}}
{%- endfor -%}
{%- endif -%}{{“”}}
zotero-link: {{desktopURI}}
citekey: {{citekey}}
tags: “#litnote, #researchnotes


{{title}} ({{date | format (“YYYY”)}})

{{“”}}
{%- if authors -%}
{%- for author in authors -%}
{{author}}
{%- endfor -%}
{%- endif -%}
{{“”}}
{%- if publicationtitle -%}
{{publicationTitle}}
{%- endif -%}
{{“”}}
Zotero URI
{{“”}}

[!abstract] Abstract
{{abstractNote}}
{{“”}}

{{bibliography}}

{{“”}}

{#- infer latest annotation Date -#}
{% macro maxAnnotationsDate() %}
{%- set tempDate = “” -%}
{%- for a in annotations -%}
{%- set testDate = a.date | format(“YYYY-MM-DD#HH:mm:ss”) -%}
{%- if testDate > tempDate or tempDate == “”-%}
{%- set tempDate = testDate -%}
{%- endif -%}
{%- endfor -%}
{{tempDate}}
{%- endmacro %}
{# infer earliest annotation date #}
{%- macro minAnnotationsDate() -%}
{%- set tempDate = “” -%}
{%- for a in annotations -%}
{%- set testDate = a.date | format(“YYYY-MM-DD#HH:mm:ss”) -%}
{%- if testDate < tempDate or tempDate == “”-%}
{%- set tempDate = testDate -%}
{%- endif -%}
{%- endfor -%}
{{tempDate}}
{%- endmacro -%}
{# infer latest note date #}
{%- macro maxNotesDate() -%}
{%- set tempDate = “” -%}
{%- for n in notes -%}
{%- set testDate = n.dateModified | format(“YYYY-MM-DD#HH:mm:ss”) -%}
{%- if testDate > tempDate or tempDate == “”-%}
{%- set tempDate = testDate -%}
{%- endif -%}
{%- endfor -%}
{{tempDate}}
{%- endmacro -%}
{#- infer earliest note date -#}
{%- macro minNotesDate() -%}
{%- set tempDate = “” -%}
{%- for n in notes -%}
{%- set testDate = n.dateAdded | format(“YYYY-MM-DD#HH:mm:ss”) -%}
{%- if testDate < tempDate or tempDate == “” -%}
{%- set tempDate = testDate -%}
{%- endif -%}
{%- endfor -%}
{{tempDate}}
{%- endmacro -%}
{# find earliest date of two dates #}
{%- macro minDate(min1, min2) -%}
{%- if min1 <= min2 -%}
{{min1}}
{%- else -%}
{{min2}}
{%- endif -%}
{%- endmacro -%}
{# find latest date of two dates #}
{%- macro maxDate(min1, min2) -%}
{%- if min1 >= min2 -%}
{{min1}}
{%- else -%}
{{min2}}
{%- endif -%}
{%- endmacro -%}

{# colorCategory to hex:
“green”: “#5fb236”,
“yellow”: “#ffd400”,
“red”: “#ff6666”,
“blue”: “#2ea8e5”,
“purple”: “#a28ae5”,
“magenta”: “#e56eee”,
“orange”: “#f19837”,
“gray”: “#aaaaaa
#}

{%- set colorToColorCategory = {
#ffd400”: “yellow”,
#ff6666”: “red”,
#5fb236”: “green”,
#2ea8e5”: “blue”,
#a28ae5”: “purple”,
#e56eee”: “magenta”,
#f19837”: “orange”,
#aaaaaa”: “gray”
}
-%}
{%- set colorCategoryToType = {
“yellow”: “yellow”,
“red”: “red”,
“green”: “green”,
“blue”: “blue”,
“purple”: “purple”,
“magenta”: “magenta”,
“orange”: “orange”,
“gray”: “gray”
}
-%}
{# lookup Zotero colors in annotations with Category #}
{%- macro colorCategoryToName(noteColor) -%}
{%- if colorCategory[noteColor]-%}
{{colorCategory[noteColor]}}
{% else %}
{{colorCategory[“yellow”]}}
{%endif%}
{%- endmacro -%}

{%- macro colorToName(noteColor) -%}
{%- if colorToColorCategory[noteColor]-%}
{{colorCategoryToType[colorToColorCategory[noteColor]]}}
{% else %}
{{colorCategoryToType[“orange”]}}
{%endif%}
{%- endmacro -%}

{%- set calloutHeaders = {
“highlight”: “Annotation”,
“strike”: “Strike Through”,
“underline”: “Underline”,
“note”: “Sticky Note”,
“image”: “Image”
}
-%}
{# lookup callout headers by type of annotation #}
{%- macro calloutHeader(type) -%}
{%- if calloutHeaders[type]-%}
{{calloutHeaders[type]}}
{% else %}
{{Note}}
{%endif%}
{%- endmacro -%}

{#- handle space characters in zotero tags -#}
{%- set space = joiner(’ ') -%}
{%- macro printTags(rawTags) -%}
{%- if rawTags.length > 0 -%}
{%- for tag in rawTags -%}
#zotero/{{ tag.tag | lower | replace(" “,”_") }} {{ space() }}
{%- endfor -%}
{%- endif -%}
{%- endmacro %}

{#- handle | characters in zotero strings used in MD -#}
{% macro formatCell(cellText) -%}
{{ cellText | replace(“|”,“:grey_exclamation:”)}}
{%- endmacro %}

{%- macro formatDate(testDate, dateFormat) -%}
{%- if testDate -%}
{{date | format (dateFormat)}}
{%- endif %}
{%- endmacro %}

{#- handle | characters in zotero strings used in MD -#}
{# {%- set comma = joiner(', ') -%}
{%- macro generateCreators(prefix) -%}
{%- for creatorType, creators in creators | groupby(“creatorType”) -%}
{{prefix}}{{ creatorType }}:: {{ space() }}
{%- for creator in creators -%}
{{ creator.firstName }} {{ creator.lastName }}
{%- if not loop.last -%}
{{comma()}}
{%- endif -%}
{%- endfor %}
{% endfor -%}
{%- endmacro -%} #}

{%- set fields = {
“title”: title or caseTitle,
“authors”: authors,
“editors”: editors,
“directors”: directors,
“podcasters”: podcasters,
“scriptwriters”: scriptwriters,
“first-entry”: minDate(minAnnotationsDate(), minNotesDate()),
“last-entry”: maxDate(maxAnnotationsDate(), maxNotesDate()),
“online-uri”: uri,
“bibliography”: bibliography,
“pdf”: pdfZoteroLink,
“year”: formatDate(date, “YYYY”),
“date”: formatDate(date, “YYYY-MM-DD”),
“extra”: extra,
“citekey”: citekey,
“pages”: numPages,
“running-time”: runningTime,
“type”: type,
“itemtype”: itemType,
“language”: language,
“url”: url,
“abstract”: abstractNote,
“collections”: collections
}
-%}

{#- generate field safely -#}
{%- macro generateField(prefix, f, p) -%}
{%- if p -%}
{{prefix}}{{f}}:: {{p}}
{% endif %}
{%- endmacro -%}

{#- generate fields based on Zotero properties -#}
{%- macro generateFields(prefix) -%}
{%- for field, property in fields -%}
{%- if property.length > 0 -%}
{{ generateField(prefix, field, property) }}
{%- endif -%}
{%- endfor %}
{%- endmacro -%}

{{ “” }}

[!info]- Metadata
{{generateFields(“> “) -}}
{{””}}
{% if relations.length > 0 -%}
[!note]- References:

title proxy note desktopURI

{%- for r in relations %}

| {{formatCell(r.title)}} | [[@{{r.citekey}}]] | Zotero Link |
{%- endfor -%}
{{ “” }}
{%- endif %}
{{ “” }}
{{printTags(tags)}}



{% persist “notes” %}
{{ “” }}
{%- set newNotes = notes | filterby(“dateModified”, “dateafter”, lastImportDate) -%}
{% if newNotes.length > 0 %}

Imported (Notes) on: {{importDate | format(“YYYY-MM-DD#HH:mm:ss”)}}

{% for note in newNotes %}

:yellow_square: Note (modified: {{ note.dateModified | format(“YYYY-MM-DD#HH:mm:ss”) }})

{{“”}}
{#- change heading level -#}
{{ note.note | replace ("# “,”### ") }}
Link to note
{{printTags(note.tags)}}

{% endfor %}
{% endif -%}
{% endpersist -%}
{% persist “annotations” %}
{%- set newAnnotations = annotations | filterby(“date”, “dateafter”, lastImportDate) -%}
{% if newAnnotations.length > 0 %}

Imported (Annotations) on {{importDate | format(“YYYY-MM-DD#HH:mm:ss”)}}

{# {% for color, colorCategory in colorToColorCategory %} #} {#-Filter empty colorCategory-#} {%- for annotation in newAnnotations -%} {# {% if loop.first -%} #}
{# #### {{colorToName(color | lower)-}} #} {# {% endif %} #}

[!annotation-{% if annotation.color %}{% if colorToColorCategory[annotation.color].length > 0 %}{{colorToColorCategory[annotation.color]}}{% else %}yellow{% endif %}]{% endif %} {{calloutHeader(annotation.type)}}
{%- if annotation.annotatedText.length > 0 -%}
{{-annotation.annotatedText | nl2br -}} {{" "}} (p. {{annotation.page}}){% endif %}{%- if annotation.imageRelativePath -%}
![[{{annotation.imageRelativePath}}|300]]
{%- endif %}{%- if annotation.ocrText -%}
{{-annotation.ocrText | nl2br-}}{%- endif -%}
{%- if annotation.comment -%}
comment:
{{annotation.comment | nl2br }}{% endif %}
[[{{annotation.date | format(“YYYY-MM-DD#HH:mm”)}}]]
{%- if annotation.tags.length > 0 %}
{{printTags(annotation.tags)}}
{% endif %}
{% endfor -%}
{# {% endfor %} #}
{%- endif -%}
{% endpersist -%}

import settings

Yeah, nothing stands out that could cause this. I also use colored emoji tags, and I’ve never encountered this. You have checked that the citekeys and titles in questions don’t contain these emojis? Also, are you using Zotero 6 or 7?

There is nothing in the citekeys or titles that contain emojis. In fact if I completely remove the title or citekey from the title of the notes in the options, it still inserts the item’s emojis tags into the note’s title/filename.

Also, neither calling the {{title}} or {{citekey}} inserts those emojis anywhere in the document. I use {{title}} and {{citekey}} multiple times in my template, and they do not have the colored tags show up anywhere near them.

I’m using Zotero 6.0.30.

Is zotero 7 ready yet? Last I checked there were virtually no plugins ready for Z7 yet because the process of transitioning is so complicated. e.g. zutilo, zotfile, afaik, have not been ported, so Z7 is just a non-starter for me. Unfortunately other plugins have dropped support for Z6 prior to Z7’s release, which has caused an equal amount of frustration. But I’m not sure it’s related to the problem at hand.

↳ Mostly, yes. It’s meant to be release out of beta this year, so it’s nearing that level of stability. As you can see here, the developers are starting to encourage people to upgrade to avoid bugs, as the beta is “fairly stable at this point”:

I’d recommend people install the Zotero 7 beta, since it’ll be much easier to forget that you have an old version of the font installed, and it might affect your ability to view newer emoji as they become available. The Zotero 7 beta has been out for months and is fairly stable at this point. - @dstillman


↳ I think there are actually quite many addons for Zotero 7 by now. Zutilo hasn’t been ported yet, no, but Zotfile has.

The main Zotfile port, called Zotero File, was temporarily taken down by the developer while it undergoes a rename, as using “Zotero” this way is protected to prevent confusion (see more on that here). There’s also another more limited port called Zotmoov that focuses on the file moving aspect.

Better Bibtex has also been ported, and some other Z7 addons to note are:

And many others as listed in this Zotero forum post.

Actions and Tags can provide a lot of the functionality of Zutilo, should the porting continue to drag out. See this comment: Zutilo in Zotero 7--Which of its functions are most essential? - Zotero Forums

Also note that you can run Zotero 7 alongside Zotero 6, if you just want to try it out without fully migrating over.

1 Like

As for the emoji issue at hand, you might get a faster response in the mgmeyers-plugin-support thread in the #academia channel on the Discord server.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.