Jim O.
Jim O.

Reputation: 1111

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

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"

Upvotes: 10

Views: 4034

Answers (2)

Dan
Dan

Reputation: 1778

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).

Upvotes: 6

Martin Schmelzer
Martin Schmelzer

Reputation: 23889

Well I fiddled me a site myself. This is working for me:

name: "my-website"
navbar:
  title: "<img id=\"logo\" style=\"width: 30px;\" src=\"dog.gif\" />"
  left:
    - text: "Home"
      href: index.html
    - text: "About"
      href: about.html

enter image description here

Upvotes: 8

Related Questions