\documentclass{article} \usepackage{hyperref} \newcommand*{\x}[1]{% \addtocontents{toc}{\protect\hypersetup{linktoc=#1}}% } \begin{document} \tableofcontents \section{Default} \x{none} \section{None} \x{section} \section{Section} \x{page} \section{Page} \x{all} \section{All} \x{warning} \end{document}