Reputation: 995
We are trying to create a very simple webpage on corona virus statistics (corona-stat.lt). We basically knit Rmarkdown in Rstudio with .Rmd --> html (here the source at GitHub). Does anybody know, if there is a way to define html meta, so that we could have
<meta property="og:url" content="corona-stat.lt" />
<meta property="og:site_name" content="Corona-Stat.lt" />
<meta property="og:image" content="https://raw.githubusercontent.com/justasmundeikis/corona-stat-lt/master/figures/corona-stat-logo.png" />
<meta property="og:type" content="page" />
from inside the index.Rmd
file, but without destroying the html code of the flatly theme
? I know, I could probably manually change the index.html file, but is too tedious to do every time we update something.
Thanks.
Upvotes: 1
Views: 262
Reputation: 131
You can use the metathis package.
Here is a basic example according to the documentation:
```{r, echo=FALSE}
#install the library before calling it
library(metathis)
meta() %>%
meta_description(
"This book will teach you how to do data science with R..."
) %>%
meta_name("github-repo" = "hadley/r4ds") %>%
meta_viewport() %>%
meta_social(
title = "R for Data Science",
url = "https://r4ds.had.co.nz",
image = "https://r4ds.had.co.nz/cover.png",
image_alt = "The cover of the R4DS book",
og_type = "book",
og_author = c("Garrett Grolemund", "Hadley Wickham"),
twitter_card_type = "summary",
twitter_creator = "@hadley"
)
```
Upvotes: 1