% This file is embedded in glossaries-extra-manual.pdf
% Example 123 Enabling unit counting to hook into hyperlink setting
% Label: "ex:unitentrycounthyper"
% arara: pdflatex
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage[colorlinks]{hyperref}
\usepackage{glossaries-extra}


\makeglossaries


\GlsXtrEnableEntryUnitCounting{general}{0}{page}


\newglossaryentry{sample}{name={sample},description={an example}}


\renewcommand*{\glslinkcheckfirsthyperhook}{%
 \ifnum\glsentrycurrcount\glslabel>0
 \setupglslink{hyper=false}%
 \fi
} 
\begin{document}
A \gls{sample} entry. Next use: \gls{sample}. 

\newpage
Next page: \gls{sample}. Again: \gls{sample}. 

\printglossaries 
\end{document}
