rr-markdownpkgdownr-usethis

pkgdown::build_site() not capturing R package logo in HTML renders


I recently got a new laptop with Windows 11 (despite my sessionInfo() stating Windows 10) and I'm trying to build a pkgdown site for an R package that I'm developing. This is not an issue that I have encountered in the past. Running the command pkgdown::build_site() does not correctly link my custom logo to the HTML sites for this R package.

Custom logo png below, for posterity: brConnectR logo

The man/figures/logo.png file was generated with usethis::use_logo("path/to/logo.png") and the favicons were generated as part of the pkgdown::build_site() process, however, the resulting docs/index.html fails to capture any logo. Below is my sessionInfo():

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] brConnectR_0.0.0.9000 usethis_2.1.3        

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.1  xfun_0.27         remotes_2.4.1     purrr_0.3.4      
 [5] rcmdcheck_1.4.0   vctrs_0.3.8       generics_0.1.1    testthat_3.1.0   
 [9] htmltools_0.5.2   yaml_2.2.1        utf8_1.2.2        blob_1.2.2       
[13] rlang_0.4.12      pkgbuild_1.2.0    pkgdown_1.6.1     pillar_1.6.4     
[17] glue_1.4.2        withr_2.4.2       DBI_1.1.1         bit64_4.0.5      
[21] xopen_1.0.0       dbplyr_2.1.1      sessioninfo_1.1.1 lifecycle_1.0.1  
[25] stringr_1.4.0     commonmark_1.7    devtools_2.4.2    memoise_2.0.0    
[29] evaluate_0.14     knitr_1.36        callr_3.7.0       fastmap_1.1.0    
[33] ps_1.6.0          curl_4.3.2        fansi_0.5.0       Rcpp_1.0.7       
[37] clipr_0.7.1       cachem_1.0.6      desc_1.4.0        pkgload_1.2.3    
[41] magick_2.7.3      fs_1.5.0          bit_4.0.4         hms_1.1.1        
[45] digest_0.6.28     stringi_1.7.5     processx_3.5.2    dplyr_1.0.7      
[49] rprojroot_2.0.2   cli_3.0.1         tools_4.1.1       odbc_1.3.2       
[53] magrittr_2.0.1    tibble_3.1.5      crayon_1.4.1      pkgconfig_2.0.3  
[57] ellipsis_0.3.2    xml2_1.3.2        prettyunits_1.1.1 assertthat_0.2.1 
[61] rmarkdown_2.11    roxygen2_7.1.2    rstudioapi_0.13   R6_2.5.1         
[65] compiler_4.1.1

Any pointers would be much appreciated!


Solution

  • I resolved this issue following the Package Logo section of the pkgdown::build_home() reference page:

    If you have a package logo, you can include it at the top of your README in a level-one heading:

    # pkgdown <img src="man/figures/logo.png" align="right" />

    init_site() will also automatically create a favicon set from your package logo.

    In addition to the above, I installed the development version of pkgdown and this fixed a cryptic warning that I was getting when running pkgdown::build_site() ("WARNING Deprecated: markdown_github. Use gfm").

    To install the dev version from GitHub: devtools::install_github("r-lib/pkgdown")