Local preview of blogdown website looks different to Netlify deploy

The local preview of my website using blogdown:::serve_site() looks different than the Netlify deploy.

For example, using HTML in the markdown files to show an image (e.g. <img src="/gifs/r-suddengains.gif"/> ) or a YouTube video (e.g. <iframe width="560" height="315" src="https://www.youtube.com/embed/4SBjIkFNAGQ" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>) does not show in the local preview using blogdown:::serve_site() but looks fine online after deployment through Netlify (see Screenshot). I can't figure out why this doesn't work anymore, maybe I'm just missing a package or something in my settings isn't right?

Any ideas why my local preview is missing some things?

> blogdown::hugo_version()
[1] ‘0.61.0’

> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3      bookdown_0.16   digest_0.6.23   later_1.0.0     mime_0.7        R6_2.4.1       
 [7] jsonlite_1.6    magrittr_1.5    evaluate_0.14   blogdown_0.17.1 rlang_0.4.2     promises_1.1.0 
[13] rstudioapi_0.10 rmarkdown_2.0   tools_3.6.2     servr_0.15      httpuv_1.5.2    xfun_0.11      
[19] yaml_2.2.0      compiler_3.6.2  htmltools_0.4.0 knitr_1.26  

Hi,

I created a new project with the default blogdown configuration and got it to render with blogdown::serve(). Sort of--it doesn't slot it in the right date or give it the correct title.

My Rmd file was simply

---
title: "Video demo"
author: "Richard Careaga"
date: "12/21/2019"
output: html_document
---

 <iframe width="560" height="315" src="https://www.youtube.com/embed/4SBjIkFNAGQ" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>)

It rendered to

---
title: "Video demo"
author: "Richard Careaga"
date: "12/21/2019"
output: html_document
---

<script src="/rmarkdown-libs/jquery/jquery.min.js"></script>
<script src="/rmarkdown-libs/elevate-section-attrs/elevate-section-attrs.js"></script>


<p><iframe width="560" height="315" src="https://www.youtube.com/embed/4SBjIkFNAGQ" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>)</p>

I haven't checked if it renders correctly on Netify!

So, the only thing I can suggest to to make sure the two scripts are where they should be in your directory and to replicate my experiment.

3 Likes

Thanks, this works now! I've also changed from markdown (.md) to R markdown (.Rmd) files, see https://bookdown.org/yihui/blogdown/output-format.html

2 Likes

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.