Topic 8: Dropdown list from a navigation bar item

TO UPDATE THIS PAGE: Open and edit the topic_8.Rmd file, in the project root, to delete this placeholder text and customize with your own!

If you look at this template, you’ll notice that some navigation bar items go directly to a single page, while the Modules item takes you to a dropdown menu.

To create a dropdown menu of pages:

  1. Create and save the pages as individual R Markdown documents as described here.

  2. Open the _site.yml file. In the navbar section, create a menu with the pages as linked items using a structure like this:

   - text: "Dropdown menu"
      menu:
        - text: "First dropdown item"
          href: item_1.html
        - text: "Second dropdown item"
          href: item_2.html

The example above would only work if the new pages were created as item_1.Rmd and item_2.Rmd, so that when the site is built the rendered item_1.html and item_2.html files exist in the docs output directory.