Skip to content

Instantly share code, notes, and snippets.



Last active Feb 11, 2021
What would you like to do?
Dynamic Meta Share Function
const handler = async (event) => {
const subject = || 'Tony'
const html = `
<!DOCTYPE html>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<title>The Sharing</title>
<meta name="description" content="A Masterpiece of the Modern Web">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="The Sharing">
<meta name="twitter:description" content="A Masterpiece of the Modern Web">
<meta name="twitter:image" content="${subject}">
<meta property="og:type" content="article">
<meta property="og:url" content="${subject}">
<meta property="og:site_name" content="The Sharing">
<meta property="og:title" content="The Sharing">
<meta property="og:description" content="A Masterpiece of the Modern Web">
<meta property="og:image" content="${subject}">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<script>window.location = '/' +;</script>
return {
statusCode: 200,
headers: {
'Content-Type': 'text/html'
body: html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment