What is the cleanest way to set the title in the document and in the PDF metadata (while not repeating myself) when also using \thanks?
This solution produces an incorrect Title metadata, that includes the content of the \thanks (or warnings from hyperref: “Token not allowed in a PDF string” when not using \maketitle).
\documentclass{article}
\usepackage[pdfusetitle]{hyperref}
\begin{document}
\title{The title\thanks{Thanks}}
\maketitle
Hello.
\end{document}
Therefore I have considered the following “solution” (rather a workaround, I’d say).
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\newcommand{\mytitle}{The title}
\title{\mytitle\thanks{Thanks}}
\hypersetup{pdftitle=\mytitle}
\maketitle
Hello.
\end{document}
But this clutters my document and is not elegant, especially because I can’t hide it in a preamble.
Is it possible instead, and would it be cleaner, to patch the way pdfusetitle works? Or is there perhaps some other workaround?

\newcommand{}...\hypersetup{}in the preamble for your workaround? – aoi Dec 17 '18 at 15:46\included in the main document) from the redactor, who would only have to deal with the main document. Putting these three lines in that sub-document does not work as the redactor now has to open the sub-document to specify the title inside the\newcommand{\mytitle}{}. – Olivier Cailloux Dec 17 '18 at 16:15