Generate metadata tags for social media cards.

meta_social(
  .meta = meta(),
  title = NULL,
  url = NULL,
  image = NULL,
  image_alt = NULL,
  image_width = NULL,
  image_height = NULL,
  description = NULL,
  twitter_card_type = c("summary", "summary_large_image", "app", "player"),
  twitter_creator = NULL,
  twitter_site = twitter_creator,
  og_type = "website",
  og_locale = "en_US",
  og_author = NULL,
  og_site_name = NULL,
  facebook_app_id = NULL,
  disable_pinterest = FALSE
)

Arguments

.meta

A meta object created by meta() or as_meta(), or returned by a meta_*() object.

title

Content title

url

Content URL

image

Image url for card.

image_alt

A description of what's in the image (not a caption)

image_width

The width of the image in pixels

image_height

The height of the image in pixels

description

Content description. If you have already used meta_general() to set the content's description, that description will automatically be used.

twitter_card_type

One of "summary", "summary_large_image", "app", or "player".

twitter_creator

@username for the content creator / author.

twitter_site

@username`` for the website used in the card footer. twitter_creator` is used by default.

og_type

Open Graph card type, default is "website". Other common options include "article", "book", or "profile". The full list of valid options can be referenced at https://ogp.me/

og_locale

The locale these tags are marked up in. Of the format language_TERRITORY. Default is "en_US".

og_author

Writers of the article. Multiple authors may be specified in a vector of character strings.

og_site_name

The name of the site hosting the content

facebook_app_id

The Facebook app ID. See the Facebook Open Graph Markup page for more information.

disable_pinterest

If TRUE, adds a metadata tag disabling pins from your website. See the Pinterest help center for more information.

Value

A meta object, or a set of <meta> HTML tags inside an HTML <head> tag. For use in rmarkdown::html_document(), shiny::runApp(), or other HTML locations.

References

See also

Examples

meta() %>% meta_social( title = "R for Data Science", description = "This book with teach you how to do data science with R", 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" )
#> <meta name="twitter:title" content="R for Data Science"/> #> <meta name="twitter:description" content="This book with teach you how to do data science with R"/> #> <meta name="twitter:url" content="https://r4ds.had.co.nz"/> #> <meta name="twitter:image:src" content="https://r4ds.had.co.nz/cover.png"/> #> <meta name="twitter:image:alt" content="The cover of the R4DS book"/> #> <meta name="twitter:card" content="summary"/> #> <meta name="twitter:creator" content="@hadley"/> #> <meta name="twitter:site" content="@hadley"/> #> <meta name="og:title" content="R for Data Science"/> #> <meta name="og:description" content="This book with teach you how to do data science with R"/> #> <meta name="og:url" content="https://r4ds.had.co.nz"/> #> <meta name="og:image" content="https://r4ds.had.co.nz/cover.png"/> #> <meta name="og:image:alt" content="The cover of the R4DS book"/> #> <meta name="og:type" content="book"/> #> <meta name="og:locale" content="en_US"/> #> <meta name="article:author" content="Garrett Grolemund"/> #> <meta name="article:author" content="Hadley Wickham"/>