shinyseo is a small helper package for Shiny apps that
need social and search metadata.
It builds one shiny::tags$head() fragment
containing:
descriptionThe package accepts either a YAML file path or a named list.
If you only need the short contract: there is one exported function,
social_meta(). It returns a shiny::tags$head()
fragment that belongs in the UI of a Shiny app.
When you call social_meta(), the package:
social_meta(meta):
meta may be a YAML path or a named listtitle, description, url, and
image are requiredmeta is a character string, it is read with
yaml::read_yaml()schema = FALSE disables JSON-LD outputschema keeps JSON-LD enabledMinimal configuration:
title: "Example app"
description: "A short app description."
url: "https://example.no"
image: "https://example.no/share.png"Common extras:
| Field | What it does |
|---|---|
locale |
Sets Open Graph locale and schema language default |
robots |
Controls the robots meta tag |
twitter_card |
Sets the Twitter card type |
site_name |
Sets og:site_name |
twitter_site |
Sets twitter:site |
twitter_creator |
Sets twitter:creator |
image_alt |
Sets og:image:alt |
twitter_image_alt |
Sets twitter:image:alt |
bing_site_verification |
Sets Bing verification |
google_site_verification |
Sets Google Search Console verification |
schema |
Set to FALSE to disable JSON-LD |
library(shiny)
library(shinyseo)
ui <- fluidPage(
social_meta("meta.yml"),
h1("My app")
)
server <- function(input, output, session) {}
shinyApp(ui, server)You can also pass a list directly:
social_meta(list(
title = "Example app",
description = "A short app description.",
url = "https://example.no",
image = "https://example.no/share.png"
))The long-form package docs live in vignettes:
If the package is installed, you can also open them with
browseVignettes("shinyseo").