Looking for help with the Zotero Integration plugin and accessing a specific data point

What I’m trying to do

I have a great template that works in Obsidian, provided by @mgmeyers in Zotero Integration – Import Templates?.

What I would like to do now is extract some extra data from the annotations-allTags-tags section that is available, and verified in the import data (example image below).

which is viewed in the Obsidian Command Palette → Zotero Integration: Data Explorer

Additionally, I used some help from @alflamingo in From Zotero to Obsidian : a tag based workflow in pictures to add the desired annotation tags to a Zotero Note Template as seen below

Things I have tried

I have tried the various following code snippets with the results in the bottom image.

tags test

{{tags}}
{{tag}}
___
{% for t in tags %}{{t.tag}}{% if not loop.last %}, {% endif %}{% endfor %}
___
{allTags}
{{allTags}}
___
{% for annot in annots -%}
{%- if annot.allTags %}
> {{annot.allTags}}
{%- endif %}
{% endfor -%}
___
{% for annot in annots -%}
{%- if annot.tags.tag %}
> {{annot.tags.tag}}
{%- endif %}
{% endfor -%}
___
{tag}
{{tag}}

Does anyone have any thought on how to dig down into the annotations-allTags-tags section? I presume it’s something like YAML but I am missing it.

Thanks

Which extra data is it you are trying to extract? I see no difference between allTags and tags, except for the data structure.

Anyway, this works:

{% for annotation in annotations -%}
{% if annotation.tags %}{% for t in annotation.tags %}#{{t.tag}}{% if not loop.last %}, {% endif %}{% endfor %}{% endif -%}
{% endfor -%}

Or formatted for clarity:

{% for annotation in annotations -%}
    {% if annotation.tags %}
        {% for t in annotation.tags %}
            #{{t.tag}}{% if not loop.last %}, {% endif %}
        {% endfor %}
    {% endif -%}
{% endfor -%}

If you don’t want the # just remove it. You can also remove {% if not loop.last %}, {% endif %} if you don’t want them comma-separated.

1 Like

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