JavaScript library that previews how your page looks when it is shared on social media.
You can install the social previews using npm:
npm install https://github.com/Yoast/yoast-social-previews.git
The simplest way to use the previews is by just specifying the target element and letting the library do the rest.
var FacebookPreview = require( "yoast-social-previews" ).FacebookPreview;
var TwitterPreview = require( "yoast-social-previews" ).TwitterPreview;
var facebookPreview = new FacebookPreview(
{
targetElement: document.getElementById( 'facebook-container' )
}
);
facebookPreview.init();
var twitterPreview = new TwitterPreview(
{
targetElement: document.getElementById( 'twitter-container' )
}
);
twitterPreview.init();
Please see CHANGELOG for more information what has changed recently.
The data that will be analyzed by YoastSEO.js can be modified by plugins. Plugins can also add new research and assessments. To find out how to do this, checkout out the customization documentation.
npm test
Generate coverage using the --coverage
flag.