How do I add custom logo in navbar title field in rmarkdown?

Viewed 3240

I would like to add a custom logo in the navbar title field section. I tried adding an html script and it worked, but the logo image did not fit inside the navbar kindly — the logo was pushed off by margins, and the menu texts overlapped the logo, etc.

name: "my-website"
output_dir: .
navbar:
  title: "I want to add custom logo here"
  left:
- text: "Home"
2 Answers

You can specify that on the YAML. For example, if using flexdashboard:

---
title: "My Website"
output: 
  flexdashboard::flex_dashboard:
    theme: flatly
    logo: LOGO.png
---

Note that no scaling is performed on the logo image, so it should fit exactly within the dimensions of the navigation bar (48 pixels high for the default "cosmo" theme, other themes may have slightly different navigation bar heights).

Related