rstudio / blogdown

Create Blogs and Websites with R Markdown
https://pkgs.rstudio.com/blogdown/
1.74k stars 330 forks source link

serve_site() fails to resolve urls in v0.21.42 #506

Closed TianyiShi2001 closed 4 years ago

TianyiShi2001 commented 4 years ago

Initially I was experience the same problem as in https://github.com/rstudio/blogdown/issues/494 . Then I upgraded to the latest developmental version and the issue was solved (i.e. the output generated by v0.21.42 is absolutely the same as v0.20). However, although the output was absolutely the same, when running blogdown::serve_site(), only v0.20 resolves the urls correctly and renders it in the Viewer pane. v0.21.42 produces something like this (unresolved urls):

image

Soon I figured out that this only happens when relativeURLs is enabled and baseURL is not /.

Minimal reproducible example

remotes::install_github('rstudio/blogdown')
blogdown::install_hugo()

In RStudio, use New Project to create a template website. In config.toml, set

baseURL = "http://tianyishi2001.github.io/foo/"
relativeURLs = true

then blogdown::serve_site()

Promise

By filing an issue to this repo, I promise that

Session Info

> xfun::session_info('blogdown')
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Manjaro Linux, RStudio 1.3.1093

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
  LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
  LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
  LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

Package version:
  base64enc_0.1.3  BH_1.72.0.3      blogdown_0.21.42 bookdown_0.21    digest_0.6.27   
  evaluate_0.14    glue_1.4.2       graphics_4.0.3   grDevices_4.0.3  highr_0.8       
  htmltools_0.5.0  httpuv_1.5.4     jsonlite_1.7.1   knitr_1.30       later_1.1.0.1   
  magrittr_1.5     markdown_1.1     methods_4.0.3    mime_0.9         promises_1.1.1  
  R6_2.5.0         Rcpp_1.0.5       rlang_0.4.8      rmarkdown_2.5    servr_0.20      
  stats_4.0.3      stringi_1.5.3    stringr_1.4.0    tinytex_0.27     tools_4.0.3     
  utils_4.0.3      xfun_0.19        yaml_2.2.1      
yihui commented 4 years ago

Should be fixed now. Thanks for the report!

remotes::install_github('rstudio/blogdown')
cderv commented 4 years ago

Awesome. Thank you !