[Tex/LaTex] addcontentsline works for section but not for chapter

sectioningtable of contents

I'm trying to add a new chapter to both the bookmarks in the PDF as well as the table of contents, without having the chapter appear on the page outside of the TOC. When I try this using \addcontentsline{toc}{chapter}{Chapter Title Here}, it gets an error and won't compile. Here's the code that errors:

\documentclass{article}
\usepackage{hyperref}
\usepackage{titlesec}

\begin{document}

\tableofcontents

\newpage

\phantomsection
\addcontentsline{toc}{chapter}{Chapter 1}

\section{First Section}

\end{document}

Interestingly, when I change chapter to section and section to subsection, everything works as I want, except that I want these to be at the chapter and section levels instead:

\documentclass{article}
\usepackage{hyperref}
\usepackage{titlesec}

\begin{document}

\tableofcontents

\newpage

\phantomsection
\addcontentsline{toc}{section}{Chapter 1}

\subsection{First Section}

\end{document}

Is there a way to fix the top example so that it works like the second example but with the desired levels?

Best Answer

The standard article class does not support the use of \chapters. Separation of \sections is typically achieved by using \parts:

enter image description here

\documentclass{article}
\usepackage{titlesec,hyperref}

\begin{document}

\tableofcontents

\newpage

\phantomsection
\addcontentsline{toc}{part}{Chapter 1}

\section{First Section}

\end{document}