Is it possible to add a field for "zotero://select" link in an edited style?

I'm editing a style for my personal use, and it would be useful to me to add a field in bibliography for the "zotero://select" link leading back to the item in my zotero library. Is this possible?

For example, I want a style that will output something like this:

Beaumont, Matthew. Utopia Ltd.: Ideologies of Social Dreaming in England, 1870-1900. Leiden: Brill, 2005. zotero://select/library/items/88NSHEZ2

Darko Suvin, Metamorphoses of Science Fiction: On the Poetics and History of a Literary Genre (New Haven: Yale University Press, 1979). zotero://select/library/items/MESH7QUT
  • I'm afraid not, no -- the unique identifier at the end of the zotero://select link is not available to citation styles (only to export translators, which in turn can't use CSL for the citation part)
  • thanks for the quick response! I have a workaround using zutilo that's not too cumbersome.
  • edited August 8, 2022
    +1 to add this feature.

    When I'm actively writing and editing my manuscripts it would be incredibly helpful if there was an easy way to turn my citations into interactive hyperlinks that point to the Zotero entry or the PDF document itself.

    I was hoping it would be possible to use CSL to format any citation such that it automatically includes a Zotero:// select link.

    ***
    @rebelprincenyc, in the meantime, would you be able to share the Zutilo workaround you're using?
  • You should be able to do this using BBT and the citekey based zotero://select link you asked about in a different thread. I believe pinned BBT citekeys should be available using CSL's citation-key variable.
  • edited August 10, 2022
    @adamsmith thank you for the encouragement! I attempted to create a CSL style like this but I'm not getting good results.

    I took two different approaches to creating the CSL style. First I created a modified version of better-bibtex-citekeys.csl by @emilianoheyns. It only involved one small modification: in the group containing the variable citation-key, I changed the value of a text field from @ to zotero://select/items/@. When I rendered this using either Marked 2 or VSCode's markdown preview window, no citekey appeared in the rendered output. It's returning errors saying ie. "[WARNING] Citeproc: Citation with no printed form: marx1990_Capi".

    Next I tried a different approach. I made a style from scratch using the visual style editor. I'm pasting it's code below.


    <?xml version="1.0" encoding="utf-8"?>
    <style xmlns="http://purl.org/net/xbiblio/csl"; class="in-text" version="1.0" demote-non-dropping-particle="never">
    <info>
    <title>zotero select link</title>
    <id>http://www.zotero.org/styles/zotero-select-link</id>;
    <link rel="self" href="http://www.zotero.org/styles/zotero-select-link"/>;
    <updated>2022-08-10T20:00:00</updated>
    </info>
    <citation>
    <layout>
    <group text-decoration="underline">
    <text variable="citation-key" font-style="normal" font-weight="normal" prefix="zotero://select/items/@"/>
    </group>
    </layout>
    </citation>
    <bibliography>
    <layout>
    <text variable="citation-key"/>
    </layout>
    </bibliography>
    </style>


    This style renders correctly in Zotero's internal Style Preview window. But when I use it with pandoc, the citations don't render at all. They're invisible, and pandoc is returning the same error message that I described above.
  • That's a pandoc question then. Not sure if and how they map the citekey to CSL.
  • I've (more or less) solved this by switching from using a .bib file for my references to a "Better CSL JSON" file.

    I found this solution via Denis on the pandoc mailing list, who writes
    save your references in the “Better CSL JSON” format. (CSL JSON is the native format for CSL references, and used by Zotero and Pandoc alike. Using bibtex/biblatex as an intermediary format is at best unnecessary.
  • Haven't gone through any past posts since the last one by @aaaaaaaaaaaaaaa - perhaps there have been new suggestions.
    In any case, two comments:
    1.) You can't tweak the CSL's, but you can tweak the export formats to look like formatted citations AND add code to add the link. Then when setting Preferences-> Export -> Item format to your new customized "Export format", you can drag-n-drop your citation to eg an external note program that includes a clickable link to the citation in Zotero.
    2.) A (non-documented?) feature just out of the blue. When you add an annotation (image or text) and drag that annotation to an external note program - Zotero natively includes all that is missing when drag-n-drop from the library proper and leaves you with something like this:

    [image] ([pdf](zotero://open-pdf/groups/1554708/items/QYULQNBG?page=4&annotation=ESQMFU4F))
    ([Morandi et al., 2019, p. 913](zotero://select/groups/1554708/items/K3T2AL3B))


    I.e. would be cool if what ever it is doing here would get natively implemented to the usual Preferences-> Export -> Item format way of doing things.
    Cheers
Sign In or Register to comment.