Problem with rendering Hugo/blogdown site

梦想与她 提交于 2020-12-12 10:07:33

问题


I've seen the post about blogdown::serve_site() no longer serving the site and read the release notes for blogdown 0.21, but it didn't help with my problem.

My workflow is/was to write a post, then click "Serve Site" in RStudio and check out the newly generated files in the public/ folder of my project. I have a symbolic link of that folder in my ShinyApps directory so I can view my site via the Shiny server. This is great, because then my colleagues who also use the server can see my site as well.
Now this doesn't work anymore. While I get the updated site in RStudio directly, the files displayed by the Shiny server are not being updated. The only explanation I can find is this one:

The global option blogdown.generator.server has been deprecated. Now blogdown::serve_site() always use the Hugo server (which corresponds to options(blogdown.generator.server = TRUE) in previous version of blogdown), instead of the server created via the servr package (which corresponds to the default options(blogdown.generator.server = FALSE) before).

I don't know much about Hugo but I found that hugo server doesn't update the public/ directory, is that correct? What can I do now to update that?


回答1:


The question was already answered on GitHub: I need to build the site with blogdown::build_site(local=TRUE).




回答2:


Edit: Turns out that the below was not the solution either for me. Therefore I posted an own question with a possible workaround:

Problem (and solution?) with rendering Hugo/blogdown site


Earlier (old) post:

With me this did not help. When updating blogdown and starting-up my R project, blogdown:::preview_site(startup = TRUE) automatically runs. Something I don't recall from earlier start-ups. I now always receive the same Error message:

Launching the server via the command: hugo server --bind 127.0.0.1 -p 4321 --themesDir themes -t hugo-academic -D -F --navigateToChanged sh: line 0: kill: (3262) - No such process Error: It took more than 30 seconds to launch the server. There may be something wrong. The process has been killed. If the site needs more time to be built and launched, set options(blogdown.server.timeout) to a larger value.

Running blogdown::build_site(local = TRUE) results in an even longer Error message starting with:

ERROR 2020/11/13 15:55:56 render of "page" failed: execute of template failed: template: _default/single.html:6:5: executing "_default/single.html" at <partial "page_header.html" .>: error calling partial: execute of template failed: template: partials/page_header.html:92:7: executing "partials/page_header.html" at <partial "page_metadata" (dict "page" $page "is_list" 0 "share" true)>: error calling partial: "/Users/frederick/Dropbox/EUR/R_work/r_website/r_website_project/themes/hugo-academic/layouts/partials/page_metadata.html:63:31": execute of template failed: template: partials/page_metadata.html:63:31: executing "partials/page_metadata.html" at <.>: range can't iterate over R


Solution for me
For me, it helped to roll-back to blogdown version 0.20 like so:

packageVersion("blogdown")
#> [1] '0.21'

library("devtools")
#> Loading required package: usethis
install_version("blogdown", version = "0.20", repos = "http://cran.us.r-project.org")
#> Downloading package from url: http://cran.us.r-project.org/src/contrib/Archive/blogdown/blogdown_0.20.tar.gz

packageVersion("blogdown")
#> [1] '0.20'

Created on 2020-11-13 by the reprex package (v0.3.0)

Now everything is back to "normal".



来源:https://stackoverflow.com/questions/64500959/problem-with-rendering-hugo-blogdown-site

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!