Main flow
- Pass a YAML file or a named list.
social_meta()reads the data.- Default values are filled in where needed.
- The four required fields are checked.
- The function builds a
tags$head()block with metadata.
shinyseoThis package generates metadata for a Shiny app and returns HTML tags
for <head>.
It is useful when you want the page to look right in shares on Facebook, LinkedIn, X, Slack, and other services that read Open Graph or Twitter Card metadata.
social_meta() reads the data.tags$head() block with
metadata.social_meta(meta) accepts:
These must always exist:
titledescriptionurlimageIf one is missing, the function stops with an error.
If you do not set them yourself, these defaults are used:
locale = "en_US"robots = "index,follow,max-image-preview:large,max-snippet:-1,max-video-preview:-1"twitter_card = "summary_large_image"bing_site_verification = Sys.getenv("SHINYSEO_BING_SITE_VERIFICATION")
when presenttwitter_site = Sys.getenv("SHINYSEO_TWITTER_SITE") when
presenttwitter_creator = Sys.getenv("SHINYSEO_TWITTER_CREATOR")
when presentschema_type = "WebApplication"operating_system = "Any"author_type = "Person"publisher_type = "Organization"in_language = localeThese fields are used directly in Open Graph:
titledescriptionurlimagesite_namelocaleimage_widthimage_heightimage_typeimage_altThese fields are used directly in Twitter Card:
twitter_cardtwitter_site with fallback to
SHINYSEO_TWITTER_SITEtwitter_creator with fallback to
SHINYSEO_TWITTER_CREATORtwitter_image_altBing verification is used directly when the following is set:
bing_site_verificationIf that field is missing,
SHINYSEO_BING_SITE_VERIFICATION is used when present.
JSON-LD is created with these base fields:
@context = "https://schema.org"@type = schema_typename = titledescription = descriptionurl = urlinLanguage = in_languageAdditional fields may be included:
application_categoryoperating_systemeducational_useis_accessible_for_freedisclaimerauthor_namepublisher_nameIf you set schema = FALSE, JSON-LD is omitted
entirely.
Use the package when you want a small, tidy metadata solution in a Shiny app without building a custom metadata engine.
It is especially useful when you: