Title: | Process Metadata from the Open Graph Protocol |
---|---|
Description: | Social media sites often embed cards when links are shared, based on metadata in the 'Open Graph Protocol' (<https://ogp.me/>). This supports extracting that metadata from a website. It further allows for the creation of tags to add to a website to support the 'Open Graph Protocol' and provides a list of the standard tags and their required properties. |
Authors: | Christopher T. Kenny [aut, cre] |
Maintainer: | Christopher T. Kenny <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.2 |
Built: | 2024-12-10 22:54:26 UTC |
Source: | CRAN |
Create Open Graph meta tags
og_create(title, type, image, url, ...)
og_create(title, type, image, url, ...)
title |
The title of your object as it should appear within the graph |
type |
The type of your object, e.g., "video.movie". Depending on the type you specify, other properties may also be required. |
image |
An image URL which should represent your object within the graph. |
url |
The canonical URL of your object that will be used as its permanent ID in the graph |
... |
Additional Open Graph properties |
A character vector of Open Graph meta tags
og_create( title = 'Process the Open Graph Protocol', type = 'website', image = 'http://christophertkenny.com/opengraph/logo.png', url = 'https://christophertkenny.com/opengraph/', description = 'Parse metadata on websites which use the Open Graph Protocol.' )
og_create( title = 'Process the Open Graph Protocol', type = 'website', image = 'http://christophertkenny.com/opengraph/logo.png', url = 'https://christophertkenny.com/opengraph/', description = 'Parse metadata on websites which use the Open Graph Protocol.' )
Parse Open Graph Metadata
og_parse(url)
og_parse(url)
url |
A string representing the URL of the webpage to parse. |
A named vector of Open Graph metadata.
og_parse('https://www.rstudio.com')
og_parse('https://www.rstudio.com')
Extract a specific Open Graph property from a webpage.
og_property(url, property)
og_property(url, property)
url |
A string representing the URL of the webpage to parse. |
property |
A string indicating the Open Graph property (e.g., "og:title" or "title"). |
A string containing the value of the specified property, or NA if not found.
og_property('https://www.rstudio.com', 'og:title')
og_property('https://www.rstudio.com', 'og:title')
As of 2024-12-05. Based on https://ogp.me/
og_schema
og_schema
A list of Open Graph schema.
og_schema
og_schema
Check if all required Open Graph properties are present.
og_validate(metadata)
og_validate(metadata)
metadata |
A named list of Open Graph metadata. |
A logical value indicating whether all required metadata is present.
og_parse('https://www.rstudio.com') |> og_validate()
og_parse('https://www.rstudio.com') |> og_validate()