I'd like to programmatically add tags to the YAML header of a blogdown post when clicking the "knit" button.
For example something like this:
---
title: This is a post
author: brshallo
date: '2022-02-11'
tags: "`r stringr::str_c('\n - ', stringr::str_flatten(c('rstats', 'datascience'), '\n - '))`"
slug: this-is-a-post
---
Related Resources
I've tried a variety of solutions with !r, !expr,
and iterations on these but so far no luck.
Here are some related threads:
- Importing common YAML in rstudio/knitr document
- How to edit an R markdown YAML header programmatically?
- https://community.rstudio.com/t/is-there-a-way-to-specify-a-nested-group-of-params-in-rmarkdown-yaml-if-not-should-there-be/117393/2
- https://community.rstudio.com/t/rmarkdown-list-in-yaml/94147/5
- packages: ymlthis and yaml
- context: blogdown#647
I'd at first assumed this was a more general rmarkdown problem rather than blogdown specific but given that some of the solutions mentioned in threads above seemed to work when inputting generic params I wasn't sure...