Importing Zotero tags with new update

What I’m trying to do

I am using a template to import highlights and metadata from Zotero to Obsidian. It has worked really well for the last few months.

With the new update that requires tags to be in a list, the imported Zotero tags come through as a long string (e.g., read, annotated_bibliography, nursing) rather than individual tags. Because this is not a valid tag, it has a red line through it and the tags don’t work.

Things I have tried

I’ve done a few searches to figure out how to address this, but it doesn’t look like anyone has run into this yet (or posted about it if they have). Because I mostly use templates, my coding knowledge is limited to simple data view queries and trying what others have done until something works.

The property looks like this:
tags: {% if allTags %}{{allTags}}{% endif %}

Is there a simple way to modify this so the tags come through in a list format and it works with the new requirements?

Thanks!

5 Likes

For anyone else struggling with this, I found a solution that works (but cannot explain how) after going through multiple templates and trial and error.

I’ve changed my tags in my literature template from
tags: {% if allTags %}{{allTags}}{% endif %}
TO
tags: [{% for t in tags %}{{t.tag}}{% if not loop.last %}, {% endif %}{% endfor %}]

5 Likes

I don’t know Zotero’s templates, but from the look of these (and having seen someone else with the problem you solved), I think the first version generates a single string of all the tags, and the second loops thru the tags and makes a string for each of them.

1 Like

I can confirm that this solution works for me as well. Thank you both!

1 Like

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