meta_social: Social Media Metadata

View source: R/social.R

meta_socialR Documentation

Social Media Metadata

Description

Generate metadata tags for social media cards.

Usage

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

Other meta: meta_apple_itunes_app(), meta_apple_web_app(), meta_general(), meta_geo(), meta_google_scholar(), meta_name(), meta_tag(), meta_viewport(), meta()

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"
  )


metathis documentation built on July 26, 2023, 5:49 p.m.