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.


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 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:
      1. Check your theme’s min hugo versions here
      2. In R run blogdown::hugo_version()
        • if you need a newer ver run blogdown::install_hugo()
      3. 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
  • 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)