Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jumpingrivers/headR
Adding meta cards to Rmd files
https://github.com/jumpingrivers/headR
knitr rmd-document rstats
Last synced: 3 months ago
JSON representation
Adding meta cards to Rmd files
- Host: GitHub
- URL: https://github.com/jumpingrivers/headR
- Owner: jumpingrivers
- Archived: true
- Created: 2018-08-31T10:50:47.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-05-04T10:23:04.000Z (over 2 years ago)
- Last Synced: 2024-05-21T02:12:38.610Z (6 months ago)
- Topics: knitr, rmd-document, rstats
- Language: R
- Homepage:
- Size: 770 KB
- Stars: 16
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output:
md_document:
variant: markdown_github
editor_options:
chunk_output_type: console
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```# HeadR
[![Build Status](https://travis-ci.org/jumpingrivers/headR.svg?branch=master)](https://travis-ci.org/jumpingrivers/headR)
__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
```{r, eval = FALSE}
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](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started.html) is present.For example, the following pages have twitter cards:
* [Twitter card](https://www.jumpingrivers.com/rpackages/headr/vignettes/twitter_large.html)
* [Twitter card + Slides](https://www.jumpingrivers.com/rpackages/headr/vignettes/twitter_slides.html)To preview the twitter card for these document, simply copy and paste the page URL into the [twitter card validator](https://cards-dev.twitter.com/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:
```{r, eval = FALSE}
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](https://www.jumpingrivers.com/)