Reference Guide

Reference for shinyseo

This 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.

Main flow

  1. Pass a YAML file or a named list.
  2. social_meta() reads the data.
  3. Default values are filled in where needed.
  4. The four required fields are checked.
  5. The function builds a tags$head() block with metadata.

Inputs

social_meta(meta) accepts:

Required fields

These must always exist:

  • title
  • description
  • url
  • image

If one is missing, the function stops with an error.

Defaults

If you do not set them yourself, these defaults are used:

What tags are created

The function builds:

Open Graph

These fields are used directly in Open Graph:

Twitter Card

These fields are used directly in Twitter Card:

Bing verification

Bing verification is used directly when the following is set:

If that field is missing, SHINYSEO_BING_SITE_VERIFICATION is used when present.

Schema.org JSON-LD

JSON-LD is created with these base fields:

Additional fields may be included:

If you set schema = FALSE, JSON-LD is omitted entirely.

Practical example

ui <- shiny::fluidPage(
  shinyseo::social_meta(list(
    title = "Calculator",
    description = "A simple app for calculating things.",
    url = "https://example.no",
    image = "https://example.no/preview.png",
    twitter_site = "@example",
    twitter_creator = "@example",
    schema = TRUE
  )),
  shiny::h1("Calculator")
)

When to use it

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: