Condense a global .bib file used for citations in a Rmarkdown article to a local .bib with only references that are used in the article.
library(condensebib)
reduce_bib(
  file       = "my_paper.Rmd",
  master_bib = "../../central_bib_file.bib",
  out_bib    = "references.bib"
)
This will look for cite keys like "@author:2008" or google-style "@authoryearword" in the input .Rmd file, extract those cite keys from the master bib, and write them to a local bib. It should work with Latex/natbib-style citation commands as well.
Requires RefManageR and stringr.
remotes::install_github("andybega/condensebib")
      
      Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.