I've played around with symlinks, which Hugo and blogdown respect. In a course website, I store all the data files in /static/data/
so they're easy to link to (/data/whatever.csv
), but I also use subdirectories for pages on the site, so I have a structure like this:
/content/lecture/01-lecture.Rmd
/content/assignments/01-assignment.Rmd
Each of those pages use data files in /static/data
, so I symlink that directory into each (see here):
/static/data -> /content/lecture/data
/static/data -> /content/assignments/data
That way, in each Rmd file, I can write code like read_csv("data/whatever.csv")
and students don't have to worry about messing with relative paths.
You could do the same thing for Rmd and data files that are completely out of your blogdown site—symlink the Markdown files and data into blogdown to maintain a single file, and the site should compile.