简体   繁体   中英

Preview of blogdown hugo page on Rstudio cloud not formatted

I am trying to follow this tutorial https://seanlee0622.medium.com/create-and-publish-a-website-with-r-and-hugo-2b7d1ff236f5 -> creating a webpage using Rstudio cloud blogdown and hugo.

When I do this with Rstudio alone (not Cloud) everything works perfect.

When I try to do the same thing with Rstudio Cloud, I get this preview:

在此处输入图像描述

I would expect this:

在此处输入图像描述

What is the reason of this behaviour and is it possible to overcome?

Here is the sessioninfo:

R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

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

Package version:
  base64enc_0.1.3  blogdown_1.11    bookdown_0.29    bslib_0.4.0      cachem_1.0.6     digest_0.6.29    evaluate_0.16   
  fastmap_1.1.0    fs_1.5.2         glue_1.6.2       graphics_4.2.1   grDevices_4.2.1  highr_0.9        htmltools_0.5.3 
  httpuv_1.6.6     jquerylib_0.1.4  jsonlite_1.8.0   knitr_1.40       later_1.3.0      magrittr_2.0.3   memoise_2.0.1   
  methods_4.2.1    mime_0.12        promises_1.2.0.1 R6_2.5.1         rappdirs_0.3.3   Rcpp_1.0.9       rlang_1.0.5     
  rmarkdown_2.16   sass_0.4.2       servr_0.24       stats_4.2.1      stringi_1.7.8    stringr_1.4.1    tinytex_0.41    
  tools_4.2.1      utils_4.2.1      xfun_0.33        yaml_2.3.5      

Hugo version: 0.102.3

This is because the Hugo theme you chose uses absURL instead of relURL in its templates. Absolute URLs won't work on RStudio Cloud. One solution is to search and replace all absURL to relURL ( Cmd/Ctrl + Shift + F ).

That will give you the correct preview of your site. However, please note that LiveReload doesn't work on RStudio Cloud, and there is not fix for this known issue yet. That means when you modify the source files, you won't get the preview automatically in RStudio Viewer. Personally I'd highly recommend working on blogdown sites on your local computer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM