ftpr-markdownshared-hostinghugoblogdown

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


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.


Solution

  • 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.