Newbie in cry for help: Zotero Integration

Hey Community,

i am doing a PHD in Policymaking, and just recently found out that obsidian is the most awesome app ever - yet i have been watching a bazillion youtube Videos in recent weeks and I keep getting lost getting Zotero Integration to work properly as I am completely ignorant about Markdown/Yaml/Programming and whatever you guys are experts in.

Can someone advice me on a minimalist approach on zotero, to build up from there? I got the templates from Bryan Jenks, yet they don’t seem to work for me (see picture).

After trying again and again for a few weeks now, I’m just super frustrated.

Thank you so much

Max

P.S: Wth is wrong with this code?

<%*
let title = “Climate finance policy in practice: a review of the evidence”;
let date = tp.date.now(“YYYY-MM-DD”);
await tp.file.rename(& ${date} ${title} );
__%>

This is Templater code.

  1. Do you have the Templater plugin installed?
  2. Have you enabled the Trigger Templater on new file creation option in Templater’s settings?

Thats solves the code question i guess, thanks!
I wont get into Templater as it doesn’t seem too relevant for a solid start, is it?

… so how can I make this minimalistic for me, while still getting all the essential functions? :smiley:

It is quite useful, but not required, no. In this case, do you really need this renaming that Templater does?

Then again, I think Bryan Jenks’ system with symbols and such is perhaps a bit involved to start with. But what exactly isn’t working for you? That screenshot looks fine, except for the unresolved Templater code I addressed above. In case you’re not aware, all the callouts are closed, you need to click to expand them and see the contents.

To do a minimalist start, just get to know the basics by reading the Zotero Integration docs and start there. Adopting someone else’s system is unlikely to be or feel minimalistic. But inspiration is always welcome, so check out this thread with template examples:

Dear Feralflora,

thank you so much for your help - I finally got a working template going now :slight_smile:

The only issue is that this template doesn’t import my comments to marked texts, any idea on where to find the hint how to do that? (I have NO IDEA about YAML, Markdown, etc. unfortunately - new to this game :frowning: )

Code of my template is:


cssclass: research-note
type: “{{itemType}}”{% for type, creators in creators | groupby(“creatorType”) -%}{% if loop.first %}
{% endif %}{{type | replace(“interviewee”, “author”) | replace(“director”, “author”) | replace(“presenter”, “author”) | replace(“podcaster”, “author”) | replace(“programmer”, “author”) | replace(“cartographer”, “author”) | replace(“inventor”, “author”) | replace(“sponsor”, “author”) | replace(“performer”, “author”) | replace(“artist”, “author”)}}: “{%- for creator in creators -%}{%- if creator.name %}{{creator.name}}{%- else %}{{creator.lastName}}, {{creator.firstName}}{%- endif %}{% if not loop.last %}; {% endif %}{% endfor %}”{% if not loop.last %}
{% endif %}{%- endfor %}{% if title %}
title: “{{title}}”{% endif %}{% if publicationTitle %}
publication: “{{publicationTitle}}”{% endif %}{% if date %}
date: {{date | format(“YYYY-MM-DD”)}}{% endif %}{% if archive %}
archive: “{{archive}}”{% endif %}{% if archiveLocation %}
archive-location: “{{archiveLocation}}”{% endif %}
citekey: {{citekey}}
aliases:
- {{title}}
- {{citekey}}
keywords: [{{allTags}}]

{{bibliography}}
online local {%- for attachment in attachments | filterby(“path”, “endswith”, “.pdf”) %} [pdf](file://{{attachment.path | replace(" ", “%20”)}})
{% if loop.last %}
{% endif %}{%- endfor %}

{% if tags.length > 0 -%}{% for t in tags -%}#{% if t.tag == “secondary” %}source/secondary{% if not loop.last %}{% endif %}{% elif t.tag == “primary” %}source/primary{% if not loop.last %}{% endif %}{% elif “-project” in t.tag %}project/{{t.tag | lower | replace(" “, “-”) | replace(”-project", “”)}}{% else %}subject/{{t.tag | lower | replace(" ", “-”)}}{% endif %}{% if not loop.last %}
{% endif %}{%- endfor %}{%- endif %}

Index

start-date:: {% if date %}{{date | format(“YYYY-MM-DD”)}}{% endif %}
end-date::
page-no:: {% for annotation in annotations %}{% if loop.first %}{{annotation.pageLabel}}{% endif %}{% endfor %}

Connections

comment::

Note

{% macro calloutHeader(color) -%}
{%- if color == “#ff6666” -%}
Important
{%- endif -%}
{%- if color == “#5fb236” -%}
Reference
{%- endif -%}
{%- if color == “#2ea8e5” -%}
Undefined - Blue
{%- endif -%}
{%- if color == “#a28ae5” -%}
Undefined - Purple
{%- endif -%}
{%- endmacro -%}

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

Imported on {{importDate | format(“YYYY-MM-DD h:mm a”)}}

{%- for annotation in annotations %}
{% if annotation.color !== “#ffd400” %}

[!quote{% if annotation.color %}|{{annotation.color}}{% endif %}] {{calloutHeader(annotation.color)}}
{%- endif -%}{% if annotation.imageRelativePath %}
![[{{annotation.imageRelativePath}}]] {% endif %}{% if annotation.annotatedText %}
{{annotation.annotatedText}} (p. {{annotation.pageLabel}}){%- endif %}{%- if annotation.comment%}
%%{{annotation.comment}}%%{%- endif %}{%- endfor %}{% endif %} {% endpersist %}

Two screens that show how the “another comment?” doesn’t transfer into zotero:


Your template formats the comments as markdown comments, which means the text is surrounded by %% on either side %%. Such comments don’t show up in reading view. So that’s probably why you don’t see them, but to make sure, you need to switch to one of the editing modes (source mode or live preview).

If you want the comments to be visible in any mode, remove the %% that surround the {{annotation.comment}}.

@maxalexander Did the suggestion above solve the issue?

It did! Thank you so much and sorry for not replying!!! :slight_smile:

Yet another one: How can I make it so that creating a new note adds the current date every time I use the template?

GOT IT!!! :smiley:

Date: <% tp.date.now(“YYYY.MM.DD HH:mm”) %>

1 Like

Great! You can mark it as solved to keep the forum organized, and open new topics for new issues.

But this is a minor thing :point_up: If you use the core Templates plugin, {{date}} should be sufficient. Otherwise, you can do it like this using the Templater plugin:
<% tp.file.creation_date("YYYY-MM-DD") %>.

Right, that works too. You beat me to it :slight_smile:

1 Like

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