Search code examples
rr-markdownnavbar

How to use submenu in rmarkdown navbar?


I am trying to create a submenu in rmarkdown navbar

here is my _site.yml

name: Test dashboard
navbar:
  title: Test dashboard
  left:
  - text: by Commo (intake)
    menu:
    - text: "Menu"
      href: index.html
    - text: "SubMenu"
      menu:
      - text: "Item1"
      - href: index2.html 
      - text: "Item2"
      - href: index3.html 
output:
  html_document:
    include:
      after_body: footer.html
    css: styles.css
    source_code: embed
    lib_dir: site_libs
    mathjax: null
    self_contained: false
output_dir: _site

However for whatever reason the links of the submenu are not displayed properly. THey are below the section names, on a very thin line which has a few pixel height.

enter image description here

Does that make sense?

I am using

> packageVersion("rmarkdown")
[1] ‘2.1’

Solution

  • I believe I found why it didn't work correctly. When I remove extra dashes (-) before hrefs at submenu level everything seems to be ok.

    Whole _site.yml looks like that:

    name: Test dashboard
    navbar:
      title: Test dashboard
      left:
      - text: by Commo (intake)
        menu:
        - text: "Menu"
          href: index.html
        - text: "SubMenu"
          menu:
          - text: "Item1"
            href: index2.html 
          - text: "Item2"
            href: https://getbootstrap.com/docs/4.4/components/alerts/
    output:
      html_document:
        include:
          after_body: footer.html
        css: styles.css
        source_code: embed
        lib_dir: site_libs
        mathjax: null
        self_contained: false
    output_dir: _site
    

    I'm using the same rmarkdown version (2.1).