简体   繁体   English

Rstudio 云上的 blogdown hugo 页面预览未格式化

[英]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.我正在尝试遵循本教程https://seanlee0622.medium.com/create-and-publish-a-website-with-r-and-hugo-2b7d1ff236f5 -> 使用Rstudio 云博客和 hugo 创建网页。

When I do this with Rstudio alone (not Cloud) everything works perfect.当我单独使用 Rstudio(不是云)时,一切正常。

When I try to do the same thing with Rstudio Cloud, I get this preview:当我尝试用 Rstudio Cloud 做同样的事情时,我得到了这个预览:

在此处输入图像描述

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.这是因为您选择的 Hugo 主题在其模板中使用absURL而不是relURL Absolute URLs won't work on RStudio Cloud.绝对 URL 不适用于 RStudio 云。 One solution is to search and replace all absURL to relURL ( Cmd/Ctrl + Shift + F ).一种解决方案是搜索所有absURL并将其替换为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.但是,请注意 LiveReload 无法在 RStudio Cloud 上运行,目前还没有修复此已知问题。 That means when you modify the source files, you won't get the preview automatically in RStudio Viewer.这意味着当您修改源文件时,您不会在 RStudio 查看器中自动获得预览。 Personally I'd highly recommend working on blogdown sites on your local computer.就我个人而言,我强烈建议您在本地计算机上处理 blogdown网站。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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