5

I tried finding a solution here and in other forums and couldn't find anything.

I'm using flexdashboard to create a website (HTML file). It has several pages, each accessible through the navbar on top. Something like:

Home
=======================================================================

Row
-----------------------------------------------------------------------

### Cover Picture {.no-title} ![](picture0.jpg)

Page 1
=======================================================================

Row
-----------------------------------------------------------------------

### Picture 1 {.no-title} ![](picture1.jpg)

Row
-----------------------------------------------------------------------

### Picture 2 {.no-title} ![](picture2.jpg)

I want to add to the navbar a link to an external website, like google. I tried simply adding something like:

[www.google.com]
=======================================================================

However when I click on that, it goes to a blank page inside my html called [www.google.com]. In order to actually go to Google's webpage, I have to right click the link and click "Open in new tab".

The same happens If I try to use a dropdown navbar Menu:

[www.google.com] {data-navmenu="External URLs"}
=======================================================================

[www.bing.com] {data-navmenu="External URLs"}
=======================================================================

I also tried inserting a name to the Page before the link:

Google's Page [www.google.com] 
=======================================================================

Or even using a custom name for the link:

[www.google.com](Google) 
=======================================================================

I understand the rationale that if I created a blank page called [www.google.com] it makes sense that If I click that in the Navbar, it goes to that blank page inside my HTML. But is there any way to make it understand that actually I don't want that blank page to exist, I just want that external Link in my Navbar?

I want the link to behave like it does if I were to write:

### [www.google.com]

When I click that, it goes straight into Google's website.

Any help is greatly appreciated.

lc23
  • 83
  • 1
  • 5
  • Too bad flexdashboard [doesn't currently support _site.yml](https://github.com/rstudio/rmarkdown/issues/784). Because external links from the navbar [are supported](http://rmarkdown.rstudio.com/rmarkdown_websites.html#site_navigation) that way. You might want to see how [rmarkdown does it](https://github.com/rstudio/rmarkdown/blob/f0cb2f1e8e8743ac114e7e62ae3ff02a105bd530/R/render_site.R). I lost the thread through the code. – wibeasley Jul 07 '17 at 19:29

1 Answers1

9

You can add a link to the right hand side using,

---
title: "My dashboard"
output:
  flexdashboard::flex_dashboard:
    navbar:
      - { icon: "fa-question-circle", href: "https://google.com", align: right }
---

In your YAML - this will put an icon of a question mark as the link. For more options, check out the section called navbar after typing ?flexdashboard::flex_dashboard into your console in R.