External Resources

Often times you will want to include external resources in your survey, things like images, videos, etc. While you can easily include these in your survey.qmd file by referencing their location in your survey project folder, these resources may not always be available in the shiny app defined in your app.R file.

To address this, you should always place external resources in a separate folder and then make sure that folder is added to Shiny’s resource path. You can do this in your app.R file by using the sd_include_folder() function at the beginning of the file after loading the surveydown package, like this:

library(surveydown)

sd_include_folder("resources")

This will make all files in a folder called resources available to Shiny.

Default folders

The surveydown package will automatically add the following folders to Shiny’s resource path:

  • www
  • images
  • css
  • js

If any of these folders exist in your project, they will automatically be added to Shiny’s resource path. For this reason, we recommend that you always put images inside a images folder in your project directory, css files inside a css folder, and so on. This will make it easier to manage your resources and ensure that they are always available to Shiny.

Back to top