/headR

Adding meta cards to Rmd files

Primary LanguageR

HeadR

Lifecycle: deprecated Build Status

headR is an R package for creating html summary cards for your R markdown files. These cards are located in the meta tags of generated HTML document and allow you add richer content when sharing your site.

To install the package, you need the devtools package

devtools::install_github("jumpingrivers/headR")

Twitter Cards

When a URL is shared on twitter, the web page is parsed to determine if a twitter card is present.

For example, the following pages have twitter cards:

To preview the twitter card for these document, simply copy and paste the page URL into the twitter card validator.

When the links are shared via twitter, the bespoke card is displayed!

The package

HeadR currently supports two types of meta tags: twitter and open graph. Usually you would have to write meta tags within your html file for them to have a visually appealing sharing format. An example of how you would add these meta tags to your Rmd document is as shown:

---   
output: 
  html_document: 
    includes:
      in_header: twitter_card.html
---

The file twitter_card.html contains meta tag information is the output of running the function headR::add_twitter_card(). More specifically:

headR::add_twitter_card(title = "This is the title!", 
                        file = "twitter_card.html", 
                        image = "http://www.example.com/path.jpg")

Development of this package was supported by Jumping Rivers