Blogdown -- lessons learned
Learning the different components of an R markdown file is complex enough for me. Blogdown really extends the learning curve up to 11 so to speak. I find it quite dizzying at times, so don’t dispare. I’ll start with a wealth of resources that I have found to keep me on solid ground.
Resources:
https://alison.rbind.io/post/up-and-running-with-blogdown/ – Alison’s Up and running, the go to guide
https://bookdown.org/yihui/blogdown/ – Yihui’s book, blogdown
https://emitanaka.github.io/talk/2018-08-28-rladies_melbourne_blogdown/ – Emi’s R-Ladies Melbourne Blogdown talk
https://github.com/rstudio-education/arm-workshop-rsc2019/issues/34 – Hosting via netlify links
http://jmcglone.com/guides/github-pages/ – Hosting via github
https://djnavarro.net/post/starting-blogdown/ – Danielle (DJ Navarro)’s getting started with blogdown. she’s much more equant a writer than me, and shares many of my frustrations.
http://jenrichmond.rbind.io/post/insights-from-the-markdown-whisperer/ – Jenny’s notes on applying Alison’s custom Hugo Academic .css file.
https://ysc-rmarkdown.netlify.com/materials/ – Alison’s Communicating with R Markdown workshop, Session 4: Collections involves blogdown and styling.
https://app.netlify.com/drop – Netlify Drag & drop online hosting, great for trouble shooting. Drop your whole
public
folder for a temporary test.
Lessons learned:
These are my two cents and notes on some of the struggles I’ve come across standing up my site. I hope this helps others.
- The repository directory can look a bit confusing at first. The gist is…
- content: compilable files such as .md, .rmd go here, this is where most of the leg work happens on your end.
- static: images, gif, and other files that are refenced in the above section belong here.
- public: when blogdown does it’s build it throws everything together in this folder and is what hosts are looking at. You don’t want to change files here, but there are automated moving pieces when the site is built.
- Don’t use nspyrison.github.io for hosting agnosticism, for your first netlify go.
- Maybe taking Emi’s hard path inadvertently (netlify and github at the same time).
- Resolving Netlify build error 255:
- tldr:
- Check your theme’s min hugo versions here
- In R run
blogdown::hugo_version()
- if you need a newer ver run
blogdown::install_hugo()
- if you need a newer ver run
- On Netlify navigate to Settings (tab along top) > Build & Deploy (menu on left) > scroll down to the Build environment variables section > Edit variables (button)
- edit or add a Key of “HUGO_VERSION” and Value of your hugo version (ie. “0.53”)
- For more through documentation, see Mara’s post
- tldr:
- Resolving: “Error building site:”C:<some path>.rda:1:1“: unmarshal of format”" is not supported"
- SOLUTION: make /data/ (or any file referenced in an .rmd) is in static/data/ or the static directory. Didn’t have to fix .rmd, and serve_site() resolved.
- symptoms: looks like standard .rda file is the wrong format. Changing data type and file type doesn’t resolve.
- symptoms: can knit .rmd locally, cannot
blogdown::serve_site()
or Build, Build Website
When in doubt, upgrade.
-Yihui Xie
update.packages(ask = FALSE, checkBuilt = TRUE)
(make sure that lib.path is not versioned)