“Zotero Integration —> Importing Paper” not working for certain Zotero item type (report)

I use Zotera Integration to import papers from Zotera to Obsidian, and create a note file using Template. However, it seems there are certain type of Zotera Item type (“report” in my case) will have issues using the template, while other has no problem.

Things that working and not working

This is the output after “Zotero Integrataion —> Importing Paper” for a “journal article” item type

This is the output after “Zotero Integrataion —> Importing Paper” for a “webpage” item type

But when I use “Zotero Integrataion —> Importing Paper” for a “report” item type, then the output turn out to be bad

I don’t know why zotero’s item type matter in this case. Why only ‘report’ item type from zotero is not working. The ‘& ${{title}} ${{date}}’ part does not work for ‘report’ import, and the new filename cannot be done properly

Things I have tried

I tried several ways to fix, but I cannot figure it out

============================

Below is the “Template - Paper” that I copy from others.

---
tags: 📥️/📜️/🟥️
publish: true
aliases: 
  - {{title}}
  - {{citekey}}
keywords: [{{allTags}}]
url: {{url}}
authors: [{{authors}}{{directors}}]
created: 
updated:
---

<%*
	let title = "{{title}}";
	let date = tp.date.now("YYYY-MM-DD");
	await tp.file.rename(`& ${title} ${date}`);
_%>

> [!meta]+ Metadata
> zotero_link:: {{pdfZoteroLink}}
> abstract:: {{abstractNote}}
> {% for relation in relations -%}
> {%- if relation.citekey -%}
> 	related:: {{relation.citekey}}
> {% endif -%}
> {%- endfor %}

> [!cite]-
> citekey:: {{citekey}}

> [!meta]-
> url:: {{url}}
> doi:: {{doi}}

```dataview
TABLE created, updated as modified, tags, type
FROM [[& <% tp.date.now("YYYY-MM-DD")%>{{title}}]]
WHERE related != null
AND contains(related, "{{citekey}}")

[!methodology]-
methodology::

[!result]- Result(s)
results::

[!summary]- Summary of Key Points
summary::

Notes

Highlight Color Meaning
Red Disagree with Author
Orange Important Point By Author
Yellow Interesting Point
Green Important To Me
Blue Notes After Initial Iteration
Purple Literary Note To Lookup Later

{% for annotation in annotations -%}
{%- if annotation.annotatedText -%}
- "{{annotation.annotatedText | escape}}” Page {{annotation.page}}
{%- endif %}
{%- if annotation.imageRelativePath -%}
![[{{annotation.imageRelativePath}}]] {%- endif %}
{%- if annotation.comment %}
- {{annotation.comment}}
{%- endif %}
{% endfor %}

[!context]-
==(How this article relates to other work in the field; how it ties in with key issues and findings by others, including yourself)==
context::

[!significance]-
==(to the field; in relation to your own work)==
significance::

Try opening the report note, and then press alt + R to trigger Templater.

Had you previously imported the report item, before running a re-import?

Because I’ve noticed that Templater doesn’t register the overwriting as a “new file creation”, so “Trigger Templater on new file creation” doesn’t come into effect when updating literature notes.

However, this doesn’t seem like the explanation in your case, because there appear to be other issues, such as a lacking title alias, compared to the other items. Try deleting the file, then run a re-import and check Obsidian’s console for any error logs:

macOS → cmd+option+i
Windows → ctrl+shift+i

1 Like

Thank you for a quick response. I realized that it s not the item type issue, but the ‘title’ has special character “:”, which is not allowed (also “/“ “\” are not allowed). I added a code in my “Paper" template like this, and it works. Thank you very much.

<%*
	let title = "{{title}}”;
	let date = tp.date.now("YYYY-MM-DD”);
	const modTitle = title.replace(/:/g, “-“)
	await tp.file.rename(`& ${modTitle} ${date}`);
_%>
1 Like

Ah, that makes sense, I didn’t register the colon when going over your report. Thanks for reporting back with your finding and solution :+1:

Btw, you can also use nunjucks templating in the Import format settings to achieve the same result without the involvement of Templater.

1 Like

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