Relund
Relund

Reputation: 651

Links not generated correctly in bookdown menu

If I have the same subsection titles in different chapters (the problem onlæy occurs if have a Rmd file for each chapter), then following the link in the menu goes to the first subsection.

I have tried to make a small reprex at https://github.com/relund/bookdown-reprex. The error only occurs when you have multiple files.

  1. Extract the zip
  2. Knit index.Rmd
  3. In the resulting output (index.html), clicking on the link for 'Learning outcomes' in the menu under Chapter 3 links to 'Learning outcomes' in Chapter 2 and not as it should to Chapter 3
xfun::session_info('bookdown')
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134), RStudio 1.3.959

Locale:
  LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
  LC_NUMERIC=C                           LC_TIME=English_United States.1252    

Package version:
  base64enc_0.1.3 bookdown_0.20   digest_0.6.25   evaluate_0.14   glue_1.4.2      graphics_3.6.3  grDevices_3.6.3 highr_0.8       htmltools_0.5.0
  jsonlite_1.7.1  knitr_1.29      magrittr_1.5    markdown_1.1    methods_3.6.3   mime_0.9        rlang_0.4.7     rmarkdown_2.3   stats_3.6.3    
  stringi_1.4.6   stringr_1.4.0   tinytex_0.25    tools_3.6.3     utils_3.6.3     xfun_0.16       yaml_2.2.1  

Upvotes: 1

Views: 49

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30114

This issue has been fixed in bookdown v0.21 (which was just released to CRAN). You can update or reinstall bookdown from CRAN:

install.packages('bookdown')
# or
update.packages(ask = FALSE, checkBuilt = TRUE)

Upvotes: 1

Related Questions