Skip to content

Latest commit

 

History

History
 
 

yoast-social-previews

Build Status Code Climate Test Coverage

yoast-social-previews

JavaScript library that previews how your page looks when it is shared on social media.

Installation

You can install the social previews using npm:

npm install https://github.com/Yoast/yoast-social-previews.git

Usage

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();

Change log

Please see CHANGELOG for more information what has changed recently.

Documentation

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.

Testing

npm test

Generate coverage using the --coverage flag.