added twitter card basics

This commit is contained in:
bill bittner 2017-08-04 18:01:05 -07:00
parent b17e013584
commit 7b14eda270
3 changed files with 26 additions and 9 deletions

View file

@ -54,10 +54,33 @@ const hbs = expressHandlebars.create({
<meta property="og:url" content="${url}" />
<meta property="og:site_name" content="spee.ch" />
<meta property="og:type" content="${type}" />
<meta property="og:description" content="${title} published via spee.ch" />
<meta property="og:${type}" content="${source}" />
<meta property="og:${type}:type" content="${mimeType}" />`
);
},
addTwitterCard (assetType, source) {
if (assetType === 'image') {
return new Handlebars.SafeString(
`<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@lbryio" />
<meta name="twitter:creator" content="@lbryio" />
`
);
} else if (assetType === 'video') {
return new Handlebars.SafeString(
`<meta name="twitter:card" content="player" />
<meta name="twitter:site" content="@lbryio" />
<meta name="twitter:image" content="https://spee.ch/assets/img/content-freedom-64px.png" />
<meta name="twitter:player" content="https://yoursite.com/container.html"/ >
<meta name="twitter:player:width" content="480" />
<meta name="twitter:player:height" content="480" />
<meta name="twitter:player:stream" content="${source}" />
<meta name="twitter:player:stream:content_type" content="video/mp4; codecs=&quot;avc1.42E01E1, mp4a.40.2&quot;" />
`
);
}
},
ifConditional (varOne, operator, varTwo, options) {
switch (operator) {
case '===':

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
@ -7,13 +7,7 @@
<title>Spee.ch</title>
<link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css">
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
<!-- twitter card -->
{{!-- <meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@spee.ch">
<meta name="twitter:creator" content="@spee.ch">
<meta name="twitter:title" content="{{fileInfo.name}}">
<meta name="twitter:description" content="An image hosted via Spee.ch">
<meta name="twitter:image" content="https://spee.ch/media/{{fileInfo.fileName}}"> --}}
{{addTwitterCard openGraphInfo.type openGraphInfo.source}}
{{addOpenGraph fileInfo.name openGraphInfo.showUrl openGraphInfo.type openGraphInfo.source fileInfo.fileType }}
</head>
<body>