I was using the code from Harish Kumar's excellent answer to this question to create a link t my table of contents. However, I wanted to alter it so that the link did not appear on the first two pages.
I tried using the \everypage package to create a hook that would exclude the first two pages from the function, but I'm not sure how to nest the hook to fit with the \ifthenelse. Every attempt I tried to somehow combine in a hook, in various combinations, resulted in a compile error.
Here is the code, which, once again, I lifted from the earlier-linked excellent answer:
\documentclass{article}
\usepackage{blindtext}
\usepackage{eso-pic}
\usepackage{hyperref}
\usepackage{ifthen}
\newboolean{linktoc}
\setboolean{linktoc}{true} %%% uncomment to show answers properly
%\setboolean{linktoc}{false} %%% comment to show answers properly
\newcommand\AtPageUpperRight[1]{\AtPageUpperLeft{%
\put(\LenToUnit{\paperwidth},\LenToUnit{-0.3\paperheight}){#1}%
}}%
\newcommand\AtPageLowerRight[1]{\AtPageLowerLeft{%
\put(\LenToUnit{\paperwidth},\LenToUnit{0.3\paperheight}){#1}%
}}%
\ifthenelse{\boolean{linktoc}}%
{%
\AddToShipoutPictureBG{%
\AtPageUpperRight{\put(-70,0){\hyperref[toc]{Go to TOC}}}
\AtPageLowerRight{\put(-70,0){\hyperref[toc]{Go to TOC}}}
}%
}%
{}%
\begin{document}
\tableofcontents\label{toc}
\Blinddocument
\end{document}
(I'm relatively new to using conditionals, so I apologize if my title or question uses incorrect terminology— please tell me if it does so I can edit it and make my question clearer)
