Change font of document title

For the standard document classes you can use the titling package to do this:

\documentclass{article}
\usepackage{titlesec}
\usepackage{titling}
\usepackage{fontspec}
% Specify different font for section headings
\newfontfamily\headingfont[]{Gill Sans}
\titleformat*{\section}{\LARGE\headingfont}
\titleformat*{\subsection}{\Large\headingfont}
\titleformat*{\subsubsection}{\large\headingfont}
\renewcommand{\maketitlehooka}{\headingfont}
\author{An author}
\title{The title of the article}
\date{\today}
\begin{document}
\maketitle
\section{A section}
\subsection{A subsection}
\subsubsection{A subsubsection}
\end{document}

output of code


I am a beginner with LaTeX. This answer helped me change the font type of the sections. But it did not change the font type of the title to match that of the sectioning. It was not so obvious to me, so I am putting the answer.

It turned out all I had to do is the following:

\title{\headingfont {The title of the article} }