D3 plot shows in RMarkdown but not in blogdown-generated webpage



Hi all,

I'm making a radar chart, based on code from here, but I'm having a weird problem that I can't figure out. When I knit the document in RStudio (Ctrl + Shift + K), it produces the desired plot in the RStudio preview browser, and in any other browser I've tried:

However, when I use blogdown::serve_site(), the plot doesn't show, either in the preview or the browser, or when I've uploaded to GitHub and had Netlify build the site:

I tried changing the location of where d3.js was being sourced from, to a local file, but then blogdown didn't find d3.js, so I changed it back to <script src="https://d3js.org/d3.v3.min.js"></script>. Any ideas as to what is happening?



Just to add more info:

Using the inspector on the RMarkdown version shows the div clearly:

While in the blogdown/Hugo version, it's empty:


I haven't actually used a d3 widget in blogdown, but it seems like this Hugo thread could be relevant:

The other thing is that, if you're knitting the Rmd in the same dir as your blogdown site, you need to clear whatever artifacts are created by knitting before running blogdown::serve_site().


Hi Mara, thanks for your reply! The original problem in that Hugo thread (which seems similar -- thanks!) seems unresolved. I also made sure to delete the previous html like you've suggested, but no difference...