'Duplicated title page in r-markdown beamer presentation

Im trying to include a title page customized in latex in my r markdown beamer presentation, but im getting two title pages in the output: one generated by R markdown and another one generated by the latex code that I included in the before-body option of the YAML header.

Is there any way to prevent r markdown from generating a title page so that I only get my personalized title page in the output?

Here is a MWE:

---
author: my-name
title: my-title
date: "`r format(Sys.time(), '%d %B %Y')`"
output: 
  beamer_presentation: 
    includes:
      before_body: title-page.tex
---

## First frame

- some content

## Second frame

- some content

Contents of title-page.tex:

\begin{frame}[plain]

\inserttitle

\insertauthor

\insertdate

\end{frame}

I already tried adding \AtBeginDocument{\let\maketitle\relax} to a file included in_header but I still got two title pages.



Solution 1:[1]

Instead of manually creating your title page, you can simply modify the frame title template:

---
author: my-name
title: my-title
date: "`r format(Sys.time(), '%d %B %Y')`"
output: 
  beamer_presentation:
    keep_tex: true
header-includes: |
  \setbeamertemplate{title page}{
    \inserttitle

    \insertauthor

    \insertdate
  }

---

## First frame

- some content

## Second frame

- some content

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1