set-open-graph
Setting Open Graph meta tags of the document.
Usage
// create an instance, set default propertiesconst openGraph = og: site_name: 'Company Name' image: 'https://www.example.com/logo.png' openGraph
The object key chain is concated to form the value of property
of <meta>
. Except these are renamed:
og:locale:current -> og:locale
og:image:url -> og:image
og:video:url -> og:video
og:audio:url -> og:audio
music:album:url -> music:album
music:song:url -> music:song
video:actor:url -> video:actor
APIs
new OpenGraph(defaults, customNS)
Creating an instance.
Params:
defaults
: Object. Default properties. For example you can set og:site_name
here so you don't need to set it every time when calling openGraph.set()
.
customNS
: Object. Default custom namespace. e.g.:
my_namespace: 'http://example.com/ns#' another_namespace: 'http://example.com/ns/another#'
You can reset defaults
and customNS
by setting this.defaults
and this.customNS
.
openGraph.set(properties, customNS)
Setting the open graph of the page. The meta elements will be inserted into document head.
openGraph.clear()
Removing the meta elements from document head.