\documentclass{article}
\usepackage{pdfpages}
\usepackage{hyperref}
\begin{document}
\nameref{mypdflabel} on page~\ref{mypdflabel}
\newpage
\newcounter{inclPDFpage}
\includepdf[pages=-,link,linkname="This is the title I want",pagecommand={\refstepcounter{inclPDFpage}\label{mypdflabel}}]{mypdf.pdf}
\end{document}
The output of the above code is simply "on page 2" but I want it to show "This is the title I want on page 2", which is what I thought nameref would do.
Any ideas on how I can get this to work?
linkname
just changes the name of the hyper anchor, but not the title of the link itself. Also you're inserting the same label again since in case of there should be more than one page in yourmypdf.pdf