Forum Discussion

PierreAulagne's avatar
PierreAulagne
Community Member
9 months ago

Use Javascript to share completion on social media with Opengraph

Hello heroes!

I have a html script (Opengraph) that enables to host an image online (here, a badge) and suggest text and hashtags for social media sharing of training completion.

The HTML script can be turned into Javascript with online tools.

I have created an image on the last training slide (congrats... share this success online, click the badge and share to your social media).

here is the Opengraph HTML script and the javascript:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:title" content="Proudly trained">
<meta property="og:description" content="This is to attest the recipient was trained by xxx">
<meta property="og:image" content="IMAGE URL (hosted online)">
<meta property="og:url" content="URL to redirect clicks">
<meta property="og:type" content="webpage">
<title>I was trained on XYZ</title>
</head>
<body>
<p>#hashtag #hashtag #hashtag</p>
</body>
</html>

Javascript I have is the exact same with each line beginning and ending:

document.write(html here);

document.write(<!DOCTYPE html>);

it does not work and I have no idea where to search. Could you please help?

 

Thanks

No RepliesBe the first to reply