Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lguenth/e8a5c4fa0b4a1ed6f8bd0b9ccfc31013 to your computer and use it in GitHub Desktop.
Save lguenth/e8a5c4fa0b4a1ed6f8bd0b9ccfc31013 to your computer and use it in GitHub Desktop.
Zotero Integration Templates
created modified
{"importDate|format(\"YYYY-MM-DD\")"=>nil}
{"importDate|format(\"YYYY-MM-DD\")"=>nil}

{{shortTitle|replace(":", " –")}}

Quelle: [[@{{citekey}}]]

{% if annotations.length > 0 -%} Hinzugefügt am [[{{importDate | format("YYYY-MM")}}#{{importDate | format("YYYY-MM-DD")}}]] {% for annotation in annotations %}{% if annotation.annotatedText %}

{{annotation.annotatedText}} (p. {{annotation.page}}) {% elif annotation.imageRelativePath %} ![[{{annotation.imageRelativePath}}]] {%- endif %} {% if annotation.comment %}- [b] {{annotation.comment}} {% endif %}{% endfor %}{% endif -%}

<%* // This uses Templater and some JavaScript to replace escaped frontmatter and wikilinks because I hate seeing them in the Quick Switcher let content = ` --- created: {{importDate|format("YYYY-MM-DD")}} modified: {{importDate|format("YYYY-MM-DD")}} ---

## {{shortTitle|replace(":", " –")}} Quelle: [[@{{citekey}}]]

{% if annotations.length > 0 -%} Hinzugefügt am [[{{importDate | format("YYYY-MM")}}#{{importDate | format("YYYY-MM-DD")}}]] {% for annotation in annotations %}{% if annotation.annotatedText %}

{{annotation.annotatedText}} ([p. {{annotation.page}}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}})) {% elif annotation.imageRelativePath %} ![[{{annotation.imageRelativePath}}]] {%- endif %} {% if annotation.comment %}- [b] {{annotation.comment}} {% endif %}{% endfor %}{% endif -%}`

const replaced = content.replace(/\/g, "") tR += replaced; -%>

<% "---" %> tags: {% if itemType == "book" %}📥/📚{% else %}📥/📑{% endif %} alias: "{{title}}" status: in-progress created: {{importDate|format("YYYY-MM-DD")}} modified: {{importDate|format("YYYY-MM-DD")}} <% "---" %>

Zusammenfassung:: Motivation:: Ergebnisse::

Projekte:: Keywords::



[!todo]+

[!meta]+ Metadaten

  • Highlights:: [[Highlights zu {{citekey}}]] {%- for attachment in attachments | filterby("path", "endswith", ".pdf") %}
  • Anhang:: PDF öffnen}}) {% if loop.last %} {% endif %}{%- endfor %}
  • Zotero:: Eintrag öffnen
  • Gelesen am::
@joennlae
Copy link

joennlae commented Nov 8, 2022

Nice template :-) The metadata one is messed up. This should fix it :-) But thanks for the template

# @{{citekey}}
> [!meta]+ Metadaten
> - *Titel*:: {{title}}
{% if authors -%}> - *Autor*:: 
	{% if creators.length > 1 -%} {%- set cond = true -%}
	    {%- for creator in creators -%}
	        {%- if cond -%}
	            {%- if creator.name == null and creator.creatorType == "author" -%}
	                {{creator.lastName}} et al.{%- set cond = false -%}
	            {%- endif -%}
	        {%- endif -%}
	    {%- endfor -%}
	{%- endif %}
{%- endif -%}
{% if authors -%}> - *Autor*::
	{% if creators.length > 1 -%} {%- set cond = true -%}
	    {%- for creator in creators -%}
	        {%- if cond -%}
	            {%- if creator.name == null and creator.creatorType == "author" -%}
	                {{creator.lastName}} et al.{%- set cond = false -%}
	            {%- endif -%}
	        {%- endif -%}
	    {%- endfor -%}
	{% else %}
	    {%- for creator in creators -%}
	        {%- if creator.name == null and creator.creatorType == "author" -%}
	            {{creator.lastName}} {{creator.firstName[0]}}.
	        {%- endif -%}
	    {%- endfor -%}
	{%- endif -%}
{%- endif -%}

@lguenth
Copy link
Author

lguenth commented Apr 20, 2023

If anyone comes across this, the fix for the author section was indeed necessary. I had fixed it locally and forgot to update. Authors are not included in the current version of this template but if you want to include them, use the fix above or a similar solution from this thread: https://forum.obsidian.md/t/zotero-integration-import-templates/36310

@nhan000
Copy link

nhan000 commented Aug 6, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment