<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage{lipsum}
\usepackage[colorlinks]{hyperref}
\usepackage{glossaries-extra}

\makeglossaries

\GlsXtrEnableEntryUnitCounting{general}{0}{page}

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

\renewcommand*{\glslinkcheckfirsthyperhook}{%
  \ifnum\glsentrycurrcount\glslabel&gt;0
   \setkeys{glslink}{hyper=false}%
  \fi
}

\begin{document}

A \gls{sample} entry. \Gls{sample2}.
Next use: \gls{sample}, \gls{sample2}.

\lipsum[1]

\Gls{sample} and more \glspl{sample}.
\Gls{sample2} and \gls{sample2}.

\newpage

Next page: \gls{sample} and \gls{sample2}.

Again: \gls{sample} and \gls{sample2}.

\lipsum[2-5]

Now for a \gls{sample} paragraph that spans the page break.
\lipsum*[6-7] The entry in the final sentence in this \gls{sample} paragraph
is incrementing and testing the count from the previous page.

Another \gls{sample} paragraph.

\printglossaries

\end{document}
</pre></body></html>