Note template customization request

Is it possible to create a "citekey" variable for the note template? Most academics using Zotero with linked notetaking apps (Obsidian, Logseq, Roam) link source pages in those apps using the citekey, so it would be a very useful addition.

Relatedly, is it possible to allow user customization of the "citation" variable? Ideally pdf highlights would be followed by (@citekey, pg. ##). Thanks.
  • There's no citekey variable in Zotero (not counting in the new Preprint item type), so, no. When all fields gain a Citation Key field, we can consider it.

    Annotation citations already include the page label of the annotation.
  • Just came here to voice my endorsement for adding a citekey variable to Zotero's metadata with the hope that it can be included in the template used to generate notes from annotations. While APA-style citation is included in extracted annotations, a citekey would allow for referencing related content in non-Zotero applications (i.e. Obsidian, Roam, and other relational databases).
  • I strongly support having a citekey variable matching the Citation Key field. That would help for note template on the one hand, and for configuring the lookup engine to get the exact paper in our field from the https://inspirehep.net/ database after pinning the Citation Key to inspire-hep using BBT.
  • @dstillman
    > When all fields gain a Citation Key field, we can consider it.

    Does this mean "when all item types gain a Citation Key field"?

    What would cause all fields or item types to gain a Citation Key field? Would this require a Zotero change or a CSL change?
  • Would this require a Zotero change or a CSL change?
    Just a Zotero change. CSL has citation-key as of 1.0.2
  • @dstillman if adding a citekey variable requires only a Zotero change, can you explain your above post a bit more so users can know what would be required for you to decide to consider, approve, or implement this change? Thanks.
  • This is just an implementation question; the addition of a citekey variable in Zoter has been decided/planned for quite some time; implementation isn't trivial but will happen alongside the other item type & field changes (which, as I understand it, will happen bit by bit).
  • edited March 25, 2022
    Thanks! Do you know this from the Zotero dev Google group, some other public site, or non-public communication? Just honestly wondering if I could have known this by following things more closely.

    EDIT: I see it was mentioned on the Google group here: https://groups.google.com/g/zotero-dev/c/5be0oTvhLvM
  • FWIW, I have basically no private communication with Zotero devs, so everything I know is based on public communication. The only exception I can think of was an alpha preview of ZotBib on which I provided feedback some years ago.
    (For CSL, we very occasionally do email amongst a small group of maintainers -- not including Zotero devs -- but that concerns organizational questions; all substantive decisions happen publicly).
  • Any news on that issue? Would really love to be able to customise the Note Format in that way!
  • I developed a workflow with an apple script, using the Automator App on Mac, that runs after a shortcut, and that changes the format of an annotation I copy in Zotero's pdf-reader. Perhaps someone who comes to this page is interested and can use and adapt it to their needs.
    It changes the default format “This ist the quote” ([Autor, Year, p. page](Link-to-item)) ([pdf](Link-to-annotation)) to *“This is the quote”* [@Autor-Year, page]-[pdf](Link-to-annotation), which gets close to the citekeys I need, to use Pandoc in Obsidian more seamless.


    -- get content from the clipboard
    set theClipboard to the clipboard

    -- extract quote
    set quotedText to do shell script "echo " & quoted form of theClipboard & " | awk -F '“|”' '{print $2}'"
    -- PAUSE set quotedText to do shell script "echo " & quoted form of theClipboard & " | awk -F '\\(\\[' '{print $1}'"

    -- extract author
    set authorRaw to do shell script "echo " & quoted form of theClipboard & " | sed -n 's/.*(\\[\\([^,]*\\), \\([0-9][0-9][0-9][0-9]\\), p\\. \\([0-9]*\\)\\].*/\\1/p'"
    -- delete brackets in the beginning & second authors & et. al
    set author to do shell script "echo " & quoted form of authorRaw & " | sed 's/^[\\[]//; s/[]]$//' | awk -F ' and' '{print $1}' | awk -F ' et al' '{print $1}'"

    -- extract year
    set pubYear to do shell script "echo " & quoted form of theClipboard & " | sed -n 's/.*(\\[\\([^,]*\\), \\([0-9][0-9][0-9][0-9]\\), p\\. \\([0-9]*\\)\\].*/\\2/p'"

    -- extract page
    set page to do shell script "echo " & quoted form of theClipboard & " | sed -n 's/.*(\\[\\([^,]*\\), \\([0-9][0-9][0-9][0-9]\\), p\\. \\([0-9]*\\)\\].*/\\3/p'"

    -- extract pdf link
    set pdfLink to do shell script "echo " & quoted form of theClipboard & " | awk -F 'open-pdf' '{print $2}' | awk -F '[)]' '{print $1}'"

    -- combine the extracted elements to the new format
    set formattedAnnotation to "*“" & quotedText & "”* [@" & author & "-" & pubYear & ", " & page & "]-[pdf](zotero://open-pdf" & pdfLink & ") "

    set the clipboard to formattedAnnotation

    display notification "Annotation successfully formatted and copied to clipboard" with title "Zotero Annotation Formatter"


Sign In or Register to comment.