I'm currently working on my thesis in rmarkdown pdf latex. Last month I made a template that worked as expected, specifically with the package hyperref. Yet, after updating R and R Studio, the feature doesn't work anymore.
I have tried the following:
Put the header-includes option in the YAML
Put the hyperref setting in the document's body specifying it is a latex code and not markdown.
The issue is that after specifying the colors of the links in with \hypersetup, the pdf output doesn't have the links colored. What is more strange is that I didn't change any of the code in weeks; I just updated R and R studio.
Move hyperref near end of preamble (#5811). It now comes after header-includes and right before title, author, date, abstract. Note: Users who presuppose hyperref in their header-includes will now have to add \usepackage{hyperref} to their header-includes to make it available there. (The redundant \usepackage will do no harm in this case.)
So adding \usepackage{hyperref} in your header.tex should have fixed the issue.
It is possible that something else changed in Pandoc's template that is impacted your document.
Your header.tex is defining a lots of things, among which some of them are already defined in the Pandoc's template, and you are not leveraging the variables like colorlinks: truePandoc - Pandoc User’s Guide