I tried the solution in How do you make a reference from all page numbers to the ToC? to add a link to Table of Contents at each page number. The solution added the links at the page numbers, but directs to the first page of the document, not the Table of Contents. The code I have used:
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[CO]{\hyperref[toc-contents]{\thepage}}
\usepackage{blindtext}
\begin{document}
\frontmatter
Page 1 \newpage
Page 2 \newpage
\label{toc-contents}
\tableofcontents
\mainmatter
\blinddocument
\end{document}
Any help?


\sectionor two, and uselipsum. – Teepeemm Jun 11 '21 at 20:02\addtocontents{toc}{\protect\label{toc-contents}}after\begin{document}. – Ulrike Fischer Jun 11 '21 at 22:08\phantomsectionbefore\tableofcontents. Although that might end on up the previous page. – Teepeemm Jun 11 '21 at 22:34