Prevent re-knitting of old rmd files when publishing blogdown website on shared server

混江龙づ霸主 提交于 2020-07-22 05:22:08

问题


I read this post and the blogdown documentation, but I can't seem to find a relevant answer for my case.

EDIT: I found this blog post describing a workaround using build_site(method="custom"). I needed to change a few things (from md to html in some parts, since the knitted final format is html in my case). It seems to work for simple Rmds, but fancy interactive plots requiring htmlwidgets don't render correctly.

I recently switched from Wordpress to Hugo and I have a shared server for hosting my website. I'm trying to understand the best workflow to push updates. I'm using blogdown::build_site() command to create a publication-ready website, but it re-renders all the old Rmd posts taking extra time. How can I set it up so it only recreates new or edited files? If I was using Netlify route, it would be pretty straightforward due to version control and server-side hugo function, but I don't know how to implement a similar solution for self-hosting.

Also in this context, what is a good workflow for dealing with blogdown sites on shared server space? I'm trying to use WinSCP FTP synchronization feature, but it needs to compare all the files and takes forever. It is not possible to sync only edited or new files as far as I know.


回答1:


Basically I'm repeating the documentation and my answer in the post you mentioned:

  1. Do not use blogdown::build_site() (again, you rarely need to use this function).

  2. Use blogdown::serve_site() to (continuously) preview the site.

  3. When you are ready to publish the site, run blogdown::hugo_build(), and publish the public/ directory.

I hope it is clear this time.



来源:https://stackoverflow.com/questions/62508839/prevent-re-knitting-of-old-rmd-files-when-publishing-blogdown-website-on-shared

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