• I don’t understand how DOI hyperlinking is supposed to work. I have a custom csl style that simply inserts the DOI variable between < and > (as ampersand codes). When I copy the item out of Zotero (desktop app) as a bibliography and paste it into a document, the actual DOI is hyperlinked and it works:

    Crous PW, Summerell BA, Carnegie AJ, Wingfield MJ, Hunter GC, Burgess TI, Andjic V, Barber PA, Groenewald JZ. 2009. Unravelling <I>Mycosphaerella</I>: do you believe in genera? Pers – Int Mycol J 23(1):99–118 <10.3767/003158509X479487>.

    In Zotpress, the same style results in printing the same, correct text, but with no hyperlink:

    Crous PW, Summerell BA, Carnegie AJ, Wingfield MJ, Hunter GC, Burgess TI, Andjic V, Barber PA, Groenewald JZ. 2009. Unravelling <I>Mycosphaerella</I>: do you believe in genera? Pers – Int Mycol J 23(1):99–118 <10.3767/003158509X479487>.

    What am I missing?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Jim

    (@jwmc)

    Update: as a test, I updated the style without the < and > around the DOI variable. Getting Zotpress to see the update was quite a struggle. Part of it involved emptying the account cache on Zotpress > Accounts. Anyway, it made no difference.

    Thread Starter Jim

    (@jwmc)

    Katie, I’ve gotten to the bottom of this, and I would like to suggest a change to shortcode.request.php, the section // Hyperlink DOIs, beginning line 664. The change is shorter than the original, covers more cases, and causes ZP to behave more like Zotero. When the style presents a DOI variable, there are really just two basic cases: a) we create a hyperlink that only shows the DOI itself (for styles that use ‘doi:’, ‘doi: ‘, or only the bare DOI), or b) a hyperlink that shows the link text as well (https://doi.org/). In the latter case, if the style presents http://doi.org/, I see no reason why ZP shouldn’t output https anyway, but maybe there is a reason.

    Here is the suggested code:

    				// Hyperlink DOIs
    if ( isset($item->data->DOI)
    // && $item->data->DOI !== null
    && strlen($item->data->DOI) > 0 )
    {
    // Styles without link text +
    if ( strpos( $item->bib, "doi.org" ) == false )
    {
    $item->bib = str_ireplace(
    $item->data->DOI,
    "<a class='zp-DOIURL' ".$zp_target_output."href='https://doi.org/".$item->data->DOI."'>".$item->data->DOI."</a>",
    $item->bib
    );
    }
    // Styles with http or https
    elseif ( strpos( $item->bib, "doi.org/" ) !== false
    && strpos( $item->bib, "</a>" ) == false )
    {
    $item->bib = preg_replace(
    "#https?://doi.org/\S+#i",
    "<a class='zp-DOIURL' ".$zp_target_output."href='https://doi.org/".$item->data->DOI."'>https://doi.org/".$item->data->DOI."</a>",
    $item->bib
    );
    }
    }
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Please explain DOI hyperlinking’ is closed to new replies.