# Getting hyperref to work with \citeyear and \citeyearpar in biblatex

When used in concert with the hyperref package, biblatex automatically creates hyperrefs for citations but not if they are inserted using \citeyear or \citeyearpar.
Is it possible to add a hyperref to year only citations?

\documentclass{article}

\usepackage[backend=biber,natbib=true, style=authoryear-comp]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{ref1,
author = {Doe, John D.},
title = {Hyperrefs to citations},
volume = {1},
date = {2000},
pages = {1--2},
}

\end{filecontents}

\usepackage{hyperref}

\begin{document}

citet -- \citet{ref1}

citeyear -- \citeyear{ref1}

citeyearpar -- \citeyearpar{ref1}

\printbibliography

\end{document}


-

One has to redefine the citation commands instructing to use hyperlink, namely:

\DeclareCiteCommand{\citeyear}
{}
{\bibhyperref{\printdate}}
{\multicitedelim}
{}

\DeclareCiteCommand{\citeyearpar}
{}
{\mkbibparens{\bibhyperref{\printdate}}}
{\multicitedelim}
{}

-

Another alternative is to use the \cite* command which is provided by all by all author-year and author-title styles. See the manual, section 3.7.2 "Style-specific Commands".

-
Welcome to TeX.SX! –  moewe Mar 31 at 9:28
Be aware though that \cite* is a "style-specific" command and as such only available in authoryear and authortitle; it also changes its behaviour depending on the style used. That is with authoryear it prints the year while with authortitle it prints the title. –  moewe Mar 31 at 9:30
Yes. My feeling is that the \citeyear behaviour is intentional in biblatex, thus my hint about \cite*. In a numeric citation style you want the [1]; in authortitle you want the title, along with the year. Only in authoryear does the link actually belong with the year, hence the \cite* command. –  Jan-Åke Larsson Mar 31 at 14:00