What I’m trying to do
I used Zotero integration to import my annotations from PDF to Obsidian. I created a template for that, which includes a link to the annotation location in Zotero, so that every imported annotation has a link. When I click it, it takes me directly to the exact annotation in Zotero. However, when I work with web page snapshots, for example from Wikipedia, I can’t import the location of the annotation using the same template.
This is my full import template:
Full template
{%- set colorCategoryToMeaning ={
"yellow": "Idea principal",
"red": "Definición (es)",
"green": "Idea secundaria o de contexto",
"blue": "Dato historico",
"purple": "Parrafo",
"magenta": "Refencia a personalidades",
"orange": "Obras y producciones",
"gray": "Preguntas y referencias"
}-%}
{# lookup Zotero colors in annotations with Category #}
{%- macro getMeaning(colorCategory) -%}
{%- if colorCategory-%}
{{- colorCategoryToMeaning[colorCategory] -}}
{%- else -%}
"Color no definido"
{%- endif -%}
{%- endmacro -%}
{%- macro printTags(rawTags) -%}
{%- if rawTags and rawTags.length > 0 -%}
{%- for tag in rawTags -%}
#[[A/0T/{{itemKey}}/🏷{{tag.tag}}|{{tag.tag}}]] {{ ' ' }}
{%- endfor -%}
{%- endif -%}
{%- endmacro -%}
{%- set frontmatter_fields = {
"title": '"' ~ (title | replace ('"','') or caseTitle | replace ('"','')) ~ '"',
"authors": '[' ~ authors | replace (";", ", ") ~ ']',
"editors": '[' ~ editors | replace (";", ", ") ~ ']',
"directors": '[' ~ directors | replace (";", ", ") ~ ']',
"translators": '[' ~ translators | replace (";", ", ") ~ ']',
"podcasters": '[' ~ podcasters | replace (";", ", ") ~ ']',
"scriptwriters": '[' ~ scriptwriters | replace (";", ", ") ~ ']',
"Tags": allTags | replace (" ", "_") | replace (",_", " "),
"first-entry": minAnnotationsDate,
"last-entry": maxAnnotationsDate,
"year": date | format("YYYY"),
"date": date | format("YYYY-MM-DD"),
"citekey": citekey,
"pages": numPages,
"running-time": runningTime,
"type": type,
"class": itemType,
"language": language,
"url": url,
"isbn": ISBN}
-%}
{# generate field safely -#}
{%- macro generateField(prefix, delimiter, f, p) -%}
{%- if p and p != "[undefined]"-%}
{{prefix}}{{f}}{{delimiter}}{{p}}
{% endif %}
{%- endmacro -%}
{#- generate fields based on Zotero properties -#}
{%- macro generateFields(prefix, delimiter, fields) -%}
{%- for field, property in fields -%}
{%- if property.length > 0 -%}
{{- generateField(prefix, delimiter, field, property) -}}
{%- endif -%}
{%- endfor -%}
{%- endmacro -%}
---
aliases: ["{{title | replace ('"','')}}"{%- if authors and date-%}, "
{%- for author in authors -%}
{{author}}
{%- endfor -%}
{{" ("+date | format("YYYY") +") "}} {{title | replace ('"','')}}{{caseTitle | replace ('"','')}}"{%- endif -%}]
{{generateFields("",": ",frontmatter_fields) -}}
---
> [!info]- Metadata
{%- if firstAttachmentZoteroLink %}
> **Zotero**: {{firstAttachmentZoteroLink}}
{%- endif -%}
{% if firstAttachmentLink %}
> **Local**: {{ firstAttachmentLink | replace("\\", "/") }}
{% endif -%}
{%- if bibliography -%}
> **Bibliografía**: {{bibliography}}
{% endif -%}
{%- if ISBN -%}
> **ISBN**: {{ISBN}}
{% endif -%}
{%- if extra -%}
> {{extra}}
{% endif -%}
{%- if itemKey -%}
> **itemKey**: {{itemKey}}
{% endif -%}
>
>> [!NOTE]- Abstract
{% if abstractNote and abstractNote.length > 0 -%}
>> {{ abstractNote | nl2br }}
{%- else -%}
>> No se encontró abstract disponible.
{%- endif -%}
{% if relations.length > 0 %}
>
>> [!note]- Relacionado:
>> | Título | Autor(es) | Enlace |
>> | --- | --- | --- |
{%- for r in relations %}
>> | {{ r.title | replace("|", "❕") }} | {% if r.creators and r.creators.length > 0 %}{{ r.creators[0].lastName }}, {{ r.creators[0].firstName }}{% else %}Autor no disponible{% endif %} | [🔗 Zotero]({{ r.desktopURI }}) |
{%- endfor -%}
{%- else %}
>
>> [!note]- Relacionado:
>> No se encontraron documentos relacionados.
{%- endif -%}
{{ "" }}
>>
**<center>Anotaciones.</center>**
{%- set newAnnotations = annotations | filterby("date", "dateafter", lastImportDate) -%}
{% if newAnnotations.length > 0 %}
{%- set noteIndex = 1 -%}
{% for annotation in newAnnotations %}
{% if annotation.type == "note" and annotation.color == "#a28ae5"%}
> [!zotero-{{annotation.colorCategory | lower}}] {{getMeaning(annotation.colorCategory | lower)}} n. {{ noteIndex }} {%- set noteIndex = noteIndex + 1 %} <br> N. {{ loop.index }} {{annotation.type|capitalize}} <br> {{ annotation.id }}
{%- else %}
> [!zotero-{{annotation.colorCategory | lower}}] {{ getMeaning(annotation.colorCategory | lower) }} <br> N. {{ loop.index }} {{annotation.type|capitalize | truncate(5)}} <br> {{ annotation.id }}
{%- endif %}
{%- if annotation.tags.length > 0 %}
🏷 - {{printTags(annotation.tags)}}
{%- endif %}
{%- if annotation.annotatedText.length > 0 %}
✒ - {{annotation.annotatedText}}
{%- endif %}
{%- if annotation.imageRelativePath %}
> ![[{{annotation.imageRelativePath}}|300]]
{%- endif %}
{%- if annotation.desktopURI %}
🔎 - ([p. {{annotation.pageLabel}}]({{annotation.desktopURI}}))
{%- endif %}
{%- if annotation.comment %}
✏ - *Comentarios*:
{{annotation.comment | replace ("<b>", "") | replace ("</b>", "") | replace ("- ", ">- ")}}
{%- endif -%}
{{" "}}
^{{ annotation.id }}
{% endfor %}
{# {% endfor %} #}
{%- endif -%}
This is the part of the templat that import the annotation location.
Annotation location in zotero
{%- if annotation.desktopURI %}
- (p. {{annotation.pageLabel}})
{%- endif %}
This is a raw of the import annotation:
Annotation Example
> [!zotero-yellow] Idea principal <br> N. 1 Highl... <br> FZXYZLMK
🏷 - #[[A/0T/TDUAES96/🏷Ejemplo|Ejemplo]]
✒ - En analisis anteriores nos hemos referido circunstancialmente a la necesidad de renovar los medios de production para que la produccion sea posible.
🔎 - ([p. 9](zotero://open-pdf/library/items/PNLA2RRV?page=9&annotation=FZXYZLMK))
✏ - *Comentarios*:
Ejemplo
^FZXYZLMK
This is how look:
This is the link for that annotation:
Things I have tried
I tried using Data Explorer to search for a property I could import with the template, but as far as I know and can see, I didn’t find anything I can link to the annotation location in Zotero.