Template talk:Doi

Problem DOI
This DOI doesn't work in the template. I tried several character encodings. It's in Sea_level_rise. (SEWilco 03:01, 22 May 2005 (UTC))
 * 10.1175/1520-0442(2002)015<0487:SOCASI>2.0.CO;2

This solution seems to work:

The above is generated by:

It may be a problem if the doi contains the string &lt;/nowiki>... Paolo Liberatore (Talk) 20:45, 29 November 2005 (UTC)


 * A DOI that is made specifically so that it doesn't work on wikipedia. That would be a sight! Ansell 03:32, 8 April 2006 (UTC)
 * Numerous DOIs using the <,>,[ and ] characters will notwork on these templates.I am not sure how to force them to display properly. Numericla entities do not appear to work. See also User:Circeus/Maple for two other examples. Circeus 14:48, 25 July 2006 (UTC)
 * My problematic DOIs are 10.2179/0008-7475(2004)069<0230:SN>2.0.CO;2 and 10.1656/1092-6194(2005)012[0023:SASEOA]2.0.CO;2 Circeus 14:55, 25 July 2006 (UTC)

It appears to be a MediaWiki bug, in that the character entity (which would be the correct way to do it) is terminating the link:

Using a URL escape works; however, since the same template parameter is also used for the display text, it does not display correctly:

--cesarb 15:35, 25 July 2006 (UTC)


 * Guess that's going to be our solution for now. I'll list the escapes when I have some time. Circeus 17:26, 25 July 2006 (UTC)


 * See also, . --Ligulem 23:17, 25 July 2006 (UTC)


 * Has this Mediawiki bug been reported?
 * For problem URLs, you could add another variable and have one variable for the displayed value and one for the percent-encoded value. — Omegatron 17:30, 11 August 2006 (UTC)

Add to template
Hi, this template is locked, so I thought I'd let someone know who has the permissions to add a bit of a "See also" section at the end:

URL encoding
Is there a good reason why you have two separate parameters instead of just using ? — Omegatron 02:19, 18 February 2007 (UTC)


 * I think I tried and failed to get anything out of . Besides, by now, we risk breaking too many uses of the template without real benefits.Circeus 22:48, 19 February 2007 (UTC)


 * The problem is bug 9031: urlencode does not treat properly. -- Jitse Niesen (talk) 10:36, 18 August 2007 (UTC)


 * This bug is fixed in newer MediaWiki versions (tried it today). In principle we could change the template. The documentation of urlencode templte states this, too: Help:Parser_function. -- Thetaphi (talk) 19:30, 24 March 2008 (UTC)


 * haven't looked at this in a while. Can we fix it while remaining backwards-compatible? — Omegatron 23:29, 24 March 2008 (UTC)


 * Original
 * Original with label
 * Proposed
 * Proposed with label
 * Proposed
 * Proposed with label
 * Proposed with label


 * Original
 * Original with label
 * Proposed
 * Proposed with label
 * Proposed
 * Proposed with label
 * Proposed with label

delete this template
Doi have add interwiki map, plese use XXXX : 10.1000/182.--Shizhao 13:00, 23 July 2007 (UTC)
 * Shouldn't that be http://dx.doi.org/10.1000/182 instead of http://www.doi.org/10.1000/182? Tizio 13:47, 23 July 2007 (UTC)
 * Never mind, I asked the folks on meta myself. Tizio 13:51, 23 July 2007 (UTC)
 * Have fix--Shizhao (talk) 08:45, 30 January 2008 (UTC)

So


 * 10.1175/1520 instead of ?

Doesn't handle special cases:


 * DOI:10.1175/1520-0442(2002)015<0487:SOCASI>2.0.CO;2

Caps
Can we have the output of the template be "DOI:" instead of "doi:" ? This is to bring this template in line with the cite journal output. --Rifleman 82 04:26, 22 October 2007 (UTC)
 * This is not good. DOIs should generally be treated as URIs and URIs should spell the "protocol"-part in lowercase (e.g. http: ftp: hdl: doi: urn:). This was discussed on German wikipedia, too and the spelling was changed to lowercase. I am member of one of the non-crossref DOI-supplying organizations (http://www.std-doi.de) and we try to propse the URI notation of DOIs. Almost all publishers use doi:, examples from our field are:, . One example how to cite a DOI: How to cite with DOI @ Elsevier -- Thetaphi (talk) 13:05, 26 March 2008 (UTC)
 * By the way: cite journal was changed to lowercase long time ago! -- Thetaphi (talk) 13:15, 26 March 2008 (UTC)
 * Seems convincing, so I changed it back to use "doi:" . Thanks for your comment. -- Jitse Niesen (talk) 14:22, 26 March 2008 (UTC)

New #urlencode function
With the new #urlencode parserfunction, there's now no need for the label parameter.

Please replace the contents of this page with those of Template:doi/editprotected.

This will automatically encode the DOI when generating a link address.

Smith609  Talk  12:54, 6 May 2008 (UTC)
 * ✅ -CapitalR (talk) 13:12, 6 May 2008 (UTC)
 * Wow, quick work! Thank you. Smith609  Talk  13:33, 6 May 2008 (UTC)


 * Hi, another fix to broken links resulting from square brackets in DOI syntax. Again, please copy from doi/editprotected.
 * Before fix: ...
 * After fix: ...
 * ✅ --CapitalR (talk) 10:41, 7 May 2008 (UTC)

Parenthesis?
The following DOI contains parentheses, and seems to fail to link properly:

(The link is there, but it the text of the DOI isn't linked.) Where is the problem here? 13:20, 14 May 2008 (UTC)

I have the same problem with, apparently all Elsevier DOIs are affected. I notice that deleting the slash also makes the problem disappear, so it is not necessarily related just to the parentheses. URL encoding does not help, and in fact, breaks the link:. Character entities do not help either:.

IIRC, the offending doi displayed OK two weaks ago, I thus strongly suspect that the bug is caused by one of the recent changes to the template. Can someone revert it to the working March 26 version, and properly debug it before making further sweeping changes? — EJ (talk) 15:59, 14 May 2008 (UTC)
 * I have reverted. The reason id/label was implemented was that, for some reason, the #urlencode simply did not work (I think there's a bug filed for it, actually). Hence the new form made the link practically invisible. Circeus (talk) 21:45, 10 June 2008 (UTC)


 * Thanks. — Emil J. (formerly EJ) 09:23, 11 June 2008 (UTC)

Parameter “label”
I don't understand what the parameter “label” is good for. The version without this parameter produces exactly the same link as the one with the parameter:





Special characters (see old version of doc) have to be replaced in the parameter “id” anyway. --Leyo 22:11, 10 June 2008 (UTC)


 * At some points, it appears that the way urls are handled was changed at they now allow unescaped carets (I was not aware of this), which was not possible back in December/January. Any attempt to use the new format with brackets still broke the template, though, hence my revert. I'll just rewrite the current documentation to account for this. Circeus (talk) 23:28, 10 June 2008 (UTC)


 * Better now? Only square brackets require the id/label system.Circeus (talk) 23:32, 10 June 2008 (UTC)
 * Please have a look at the source code of my examples. Both types of brackets have to be replaced in the parameter “id” as shown here. Like this, the link is working and the link text is correct, even without using the parameter “label”. --Leyo 08:12, 11 June 2008 (UTC)
 * I looked at that and spent twenty minutes Monday fiddling and trying to figure out just what the heck was to be replaced by what in which parameters before giving up. Whatever one was supposed to do, the page was not clear enough about what it was. Circeus (talk) 17:25, 11 June 2008 (UTC)
 * I don't exactly understand what you mean. However, it seems that this parameter is not in use very often: Template Tiger result. --Leyo 19:05, 14 June 2008 (UTC)


 * ✅ Cheers, PeterSymonds (talk)  12:03, 24 June 2008 (UTC)

The label parameter is now redundant due to the new parser function.

Please copy the new source from Template:Doi/edit.

Example:

Martin  (Smith609 – Talk)  11:17, 24 June 2008 (UTC)

Tweak for print
Replace current code with this one (copy-paste)

This will help cleanup PDF and Books. Headbomb {{{sup|ταλκ}}κοντριβς – WP Physics} 21:44, 3 March 2010 (UTC)
 * ✅  Ron h jones (Talk) 23:49, 5 March 2010 (UTC)
 * Great. Thanks a bunch. Headbomb {talk / contribs / physics / books} 05:22, 6 March 2010 (UTC)

Add doi-check
If an admin could put doi/sandbox into doi, that would be peachy. What it does is check if the DOI starts with '10.Foobar'. If not, it throws an error message and populates Category:Pages with DOI errors. It's tested and everything. Headbomb {talk / contribs / physics / books} 19:13, 6 March 2012 (UTC)
 * Yes check.svg Done -- Red rose64 (talk) 19:42, 6 March 2012 (UTC)

Reccomendation to use is outdated
This page says:


 * Usually, this template is preferred:

However, if you follow the link below to Template:cite doi you see two big warning signs telling you to use Template:cite journal instead. Can this page be updated to reflect the new consensus? --holizz (talk) 13:39, 26 April 2015 (UTC)


 * Exactly. What's the difference?  We still do know, two years later...  KDS4444 (talk) 01:36, 13 August 2017 (UTC)

Doi and only in print template
Please check Template talk:Only in print. --Obsuser (talk) 22:26, 21 July 2016 (UTC)

RFCs on citations templates and the flagging free-to-read sources
See
 * Village pump (proposals)
 * Village pump (proposals)

Headbomb {talk / contribs / physics / books} 17:04, 29 October 2016 (UTC)

Usage
The template documentation given here explains how to use this template to produce a link to a DOI document without producing an error. Which is great. But it does NOT explain to an editor WHERE to use such a template, which means knowledge of correct application of the template is presumed. I have my own guesses, but it would be great if someone involved with this template provided at least a few sentences in the template documentation explaining where a person might want to use this template on Wikipedia. Thank you. KDS4444 (talk) 01:35, 13 August 2017 (UTC)

Template-protected edit request on 25 August 2017
Please remove dx. from the template: "DOIs may be structured to use the default public DOI proxy server https://doi.org (note that https is preferred over http, and that dx.doi.org, an earlier syntax, will remain fully supported but is no longer preferred)." Paradoctor (talk) 21:25, 25 August 2017 (UTC)
 * Yes check.svg Done (diff) Matt Fitzpatrick (talk) 05:27, 26 August 2017 (UTC)

Suggested simplification
A doi has two functions, right? (1) As an identifier, and (2) as a (more or less) stable link to a web page. I would question the sense of actually displaying the identifier in WP articles, as seeing the identifier has rather few uses that I can see, but it adds considerably to complexity and clutter, thereby distracting from what is really important. It is somewhat like using pi, in the sense that you can use pi in a calculation without needing to see the actual approximation being used. So, why not display doi links just as the term doi, without displaying the identifier bit? If someone really did want to see what the identifier actually is, for some reason, then they still have 3 easy options: (1) Go into edit mode to see the doi link in full; or (2) Use the 'Copy link address' facility on their browser; or (3) Click on the doi link and see the full identifier on the linked web page. Generally speaking, I would suggest that articles with lots of unnecessary identifiers showing is a bad idea. Thoughts? Comments? GruesomeBalls (talk) 08:59, 3 November 2020 (UTC)
 * As with all identifiers, this would cause issues with copying text out of WP, or printing WP pages, or similar actions where having the actual DOI/ISBN/ISSN visible is helpful. – Jonesey95 (talk) 15:23, 3 November 2020 (UTC)
 * Same for copy-pasting the identifier into various citation tools, research tools, etc, without having to edit the page. &#32; Headbomb {t · c · p · b} 16:13, 3 November 2020 (UTC)
 * @Headbomb Actually, no, the 'copy link address' facility on browsers would work fine. The only thing is that you wouldn't be able to copy the reference citation and the doi in one go. However, that would only be significant for wholesale copying. For an individual reference, it would take only a second or two longer GruesomeBalls (talk) 20:42, 3 November 2020 (UTC)


 * @Jonesey95 My above reply to Headbomb applies also to your comment. Printing would indeed be an issue, but I wonder how often people actually need hard copy dois? For a start, as a hard copy, the doi is *only* an identifier and not a link, so not very useful! GruesomeBalls (talk) 20:45, 3 November 2020 (UTC)
 * It's very useful. If I'm reading a printed document, and they mention a journal article with
 * A. Ali; G. Kramer (2011). "JETS and QCD: A Historical Review of the Discovery of the Quark and Gluon Jets and Its Impact on QCD". European Physical Journal H. 36 (2): 245. arXiv:1012.2288. Bibcode:2011EPJH...36..245A. doi:10.1140/epjh/e2011-10047-1. S2CID 54062126.
 * I'm not going to enter all of that information in a search engine. I'm going to plunk in the DOI in google (or Library search engine), and go from there. [Or arxiv, bibcode, etc.]&#32; Headbomb {t · c · p · b} 02:25, 4 November 2020 (UTC)
 * You can still do that without seeing the doi! As I said, you just copy link address from a hyperlink which displays only as "doi", without seeing the identifier. My proposal makes no difference to how anyone uses a doi, only what they see. GruesomeBalls (talk) 03:13, 4 November 2020 (UTC)
 * There is nothing that you can't do with doi that you can do with https://doi.org/10.1140/epjh/e2011-10047-1
 * GruesomeBalls (talk) 03:17, 4 November 2020 (UTC)
 * Well, you're free to propose changes for this behaviour at Help talk:CS1, but I don't think you'll find much support for the idea that
 * A. Ali; G. Kramer (2011). "JETS and QCD: A Historical Review of the Discovery of the Quark and Gluon Jets and Its Impact on QCD". European Physical Journal H. 36 (2): 245. arXiv. Bibcode. doi. S2CID.
 * is better than
 * A. Ali; G. Kramer (2011). "JETS and QCD: A Historical Review of the Discovery of the Quark and Gluon Jets and Its Impact on QCD". European Physical Journal H. 36 (2): 245. . ..
 * &#32; Headbomb {t · c · p · b} 05:27, 4 November 2020 (UTC)

DOIs with spaces in them
encodes as https://doi.org/10.1126/science.+1140516 instead of as https://doi.org/10.1126/science.%201140516 Note that this DOI has a space in it! AManWithNoPlan (talk) 19:09, 27 January 2021 (UTC)
 * switched to PATH uri encoding.
 * —Trappist the monk (talk) 19:47, 27 January 2021 (UTC)
 * I am not sure anything can be done about this but it should probably be noted that this also fails with interwikilinks, e.g.: 10.1126/science. 1140516 renders the link with an underscore instead of a space. —Uzume (talk) 01:45, 7 December 2021 (UTC)
 * It might be better to give an example that has the possibility of linking to a valid DOI. – Jonesey95 (talk) 03:14, 7 December 2021 (UTC)
 * The example doi in this discussion was once a working identifier (with the space); it still works to some extent because you don't get the doi.org error page but rather you get a 404 error at science.org. I expect that that doi has been replaced with something else.  Regardless, it is doubtful that the interwikilink form  can ever be made to work because MediaWiki treats interwikilinks like any regular wikilink: urls are created from the wikilink syntax such that spaces (even when percent encoded) are replaced with underscores.  And why is   an interwiki prefix anyway?  The template works because it does not replace spaces with underscores.  I suppose one might wander over to phabricator and propose that if non-mediawiki sites can be interwikilinked, the 'interwiki' urls created should not use underscores for spaces in the url.
 * This particular doi was also discussed at.
 * —Trappist the monk (talk) 13:33, 7 December 2021 (UTC)
 * —Trappist the monk (talk) 13:33, 7 December 2021 (UTC)

doi-access=free
I have hacked the sandbox to use so that the doi identifier can be marked as free-to-read in the same way that a free-to-read doi in a cs1|2 template can be marked: free. The Template:doi/testcases failures are not really failures. The live version of this template does not trim whitespace from the doi so the leading whitespace in  (test 2) appears in the final rendering but  does trim whitespace so the whitespace is not rendered.

The sandbox version of this template supports the cs1|2  access indicator which is accomplished by template styles so the sandbox rendering includes the necessary template styles stripmarker:

I may tweak to suppress the template styles when an access icon is not required...

Using free (no other value supported):

Without objection, I shall update the live template.

—Trappist the monk (talk) 14:17, 10 August 2022 (UTC)
 * There having been no objection, updated.
 * —Trappist the monk (talk) 13:23, 18 August 2022 (UTC)