Search code examples
rpkgdown

How to move "Get Started" to articles in pkgdown


Usually, pkgdown websites have a "Get Started" section in the navbar.

However, user feedback I had is that people only look at the examples in the readme, then click on the articles, without even noticing this section.

The "Get Started" article comes from the vignette with the same name as the package (cf. https://pkgdown.r-lib.org/reference/build_articles.html#get-started).

Is there a way to move the "Get started" navbar item to an article named "Get started"?

Related: https://github.com/r-lib/pkgdown/issues/1405


Solution

  • Following Hadley's advice in the referenced link I created a fresh package named foo, added two toy vignettes foo and bar and moved the "Get started" vignette from the navbar to the articles section using this _pkgdown.yml, i.e. following the docs remove intro from the navbar structure and add the get started vignette under the articles section:

    url: ~
    template:
      bootstrap: 5
    
    navbar:
      structure:
        left:  [reference, articles, tutorials, news]
        right: [search, github]
      components:
        articles:
          text: Articles
          menu:
          - text: Get started
            href: articles/foo.html
          - text: Other
            href: articles/bar.html
    

    enter image description here