Zotero Integration - Relations 2

Hi all,
I am reposting something I had already published on the forum. I received some advice, but I couldn’t find any useful templates to solve the problem.
I use Zotero Integration to import my library into Obsidian using the following template:

Authors: {{authors}}
Title: {{title}}
Year: {{date | format(“YYYY”)}}
Tags: {{hashTags}}
Abstract: {{abstractNote}}
Citation: {{bibliography}}
Relations:
{% for relation in relations %}

  • [[{{ relation | replace(“zotero://select/items/”, “”) }}]]
    {% endfor %}

    Zotero link: {{pdfZoteroLink}}

Everything works fine, except for the “Relations” field, which should make the related library items in Zotero appearing. The possibility is indicated by the existence of the “Relations” field visible in Zotero Data Explorer.
I’m not skilled in Nunjucks programming, and the data seems nested. I would also like it to become recursive, so that it auto-updates as soon as a new relation is added in Zotero.
If it worked, I could view all the connections in my Zotero library in Obsidian.
Thanks for your help!
Fabio

Each relation is an object with various keys, so you can’t just do relation and you can’t perform string replacements on the object. You have to access the keys of the relation object that you want to process and insert.

For example:

{% for relation in relations -%}
- [[{{relation.citekey}}]]
{% endfor %}

Can you clarify the above? What does it being recursive have to do with it auto-updating? And what exactly do you mean by “it”? Can you say more about how you envision the auto-updating?

Dear @Feralflora many thanks, the string works perfectly!!

Yes the idea of the recursive was to have the itames updated on Obsidian for the changes on Zotero, but I guess that the relation is one-way, so probebly the question did not make sense.

Thanks again!