I used the default example bib from the current biblatex documentation which is available on every TeX distribution. The two entries have both a doi entry in the bib file:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber]{biblatex}
\usepackage[colorlinks]{hyperref}
\bibliography{biblatex-examples}
\ExecuteBibliographyOptions{doi=false}
\newbibmacro{string+doi}[1]{%
\iffieldundef{doi}{#1}{\href{http://dx.doi.org/\thefield{doi}}{#1}}}
\DeclareFieldFormat{title}{\usebibmacro{string+doi}{\mkbibemph{#1}}}
\DeclareFieldFormat[article]{title}{\usebibmacro{string+doi}{\mkbibquote{#1}}}
\begin{document}
A reference to~\cite{kastenholz} and~\cite{sigfridsson}.
\printbibliography
\end{document}
With the latest biblatex update there is also a star version for \DeclareFieldFormat
which refers to all entry types.
With respect, it doesn't make much sense to have the ENTIRE bib entry link to the DOI page, since, an individual bibliography record may have BOTH URL and DOI's, either, or neither.
I use the following command, along with the hyperref package, which gives a blue colored hyperlink to the DOI webpage for the bibliography entries that have DOI records.
In the preamble, put the following:
\usepackage[hidelinks]{hyperref} %boxes hidden, remove hidelinks if boxes are desired.
Then before the bibliography is called:
\def\mybibdoicolor{\color{blue!75!black}} %change color to suit.
\newcommand*{\doi}[1]{\href{http://dx.doi.org/\detokenize{#1} {\raggedright\mybibdoicolor{DOI: \detokenize{#1}}}}
Finally, the bibliography can be called:
\bibliography{BIBDATAFILE}
An exerpt from my output is displayed below, noting the blue DOI record/s held in references [41-43], each can be clicked from inside PDF, in such event, the user would be redirected to the relevant site. In this case, as an example, should the user click on the DOI record inside [41], he/she would be redirected to http://dx.doi.org/10.1098/rspa.1925.0147, which in turn redirects the user to the publication.
Best Answer
While you can use
\doitext
to modify what is displayed before the doi, it will never be within the hyperlink. To simulatedoi.sty
(without using it), you can do the following:The only thing I changed is that I grouped
\doitext
with\the\toks0
. The macro\the\toks1
, which comes before, contains the\href
command, which then applies to the whole group.You might want to contact one of the maintainers to ask them to make this an option in future versions of
doi.sty
.