r-lib / pkgdown

Generate static html documentation for an R package
https://pkgdown.r-lib.org/
Other
713 stars 335 forks source link

Menu duplication when aligned right #2014

Closed dbosak01 closed 2 years ago

dbosak01 commented 2 years ago

Starting from pkgdown 2.0.0 I'm getting duplication of my navbar menus when it is aligned right. The relevant portion of my _pkgdown.yml looks like this:

navbar:
  type: inverse
  structure:
    right: [home, intro, articles, reference, faq, news, github]
  components:
    faq:
      text: FAQ
      href: ./articles/fmtr-faq.html

And the effect is this: image

If it is aligned left, or I use pkgdown version 1.6.1, the duplication does not occur.

image

I apologize for not submitting a complete reproducible example. In this case, I don't know how to supply one except to submit my entire package. My _pkgdown.yml is attached. _pkgdown.yml.txt

maelle commented 2 years ago

PR that created the unexpected behavior https://github.com/r-lib/pkgdown/pull/1517/

maelle commented 2 years ago

Thanks for the bug report, I can reproduce it.

Before there's a fix a workaround is having

navbar:
  type: inverse
  structure:
    right: [home, intro, articles, reference, faq, news, github]
    left: []

in your configuration file.

dbosak01 commented 2 years ago

Thanks for the workaround. It works!

maelle commented 2 years ago

Good to hear! #2016 should be an actual fix (or maybe not if I got it wrong, so you're safer with the workaround for now :sweat_smile:)

maelle commented 2 years ago

Related #2070 (might break the workaround)

hadley commented 2 years ago

I don't think that's a workaround; I think that's the desired behaviour — if you don't specify a field it inherits from the default, so here you want to explicitly say that you don't want any elements on the LHS of the navbar.