Open graph #132

Merged
bones7242 merged 14 commits from open-graph into master 2017-08-08 07:09:36 +02:00
3 changed files with 12 additions and 11 deletions
Showing only changes of commit 35cf994149 - Show all commits

View file

@ -90,15 +90,8 @@ const hbs = expressHandlebars.create({
); );
} }
}, },
addTwitterCard (assetType, source) { addTwitterCard (source, mimeType) {
if (assetType === 'image') { if (mimeType === 'video/mp4') {
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( return new Handlebars.SafeString(
`<meta name="twitter:card" content="player" /> `<meta name="twitter:card" content="player" />
<meta name="twitter:site" content="@lbryio" /> <meta name="twitter:site" content="@lbryio" />
@ -110,6 +103,12 @@ const hbs = expressHandlebars.create({
<meta name="twitter:player:stream:content_type" content="video/mp4; codecs=&quot;avc1.42E01E1, mp4a.40.2&quot;" /> <meta name="twitter:player:stream:content_type" content="video/mp4; codecs=&quot;avc1.42E01E1, mp4a.40.2&quot;" />
` `
); );
} else {
return new Handlebars.SafeString(
`<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@lbryio" />
<meta name="twitter:creator" content="@lbryio" />`
);
} }
}, },
ifConditional (varOne, operator, varTwo, options) { ifConditional (varOne, operator, varTwo, options) {

View file

@ -8,7 +8,7 @@
<link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css"> <link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css">
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css"> <link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
<meta property="fb:app_id" content="1371961932852223"> <meta property="fb:app_id" content="1371961932852223">
{{{addTwitterCard openGraphInfo.type openGraphInfo.source}}} {{{addTwitterCard openGraphInfo.source fileInfo.fileType}}}
{{{addOpenGraph fileInfo.name openGraphInfo.showUrl openGraphInfo.source fileInfo.fileType }}} {{{addOpenGraph fileInfo.name openGraphInfo.showUrl openGraphInfo.source fileInfo.fileType }}}
</head> </head>
<body> <body>

View file

@ -6,8 +6,10 @@
{{!--fallback--}} {{!--fallback--}}
Your browser does not support the <code>video</code> element. Your browser does not support the <code>video</code> element.
</video> </video>
{{else}} {{else}}
<img class="show-asset-lite" src="/media/{{fileInfo.fileName}}" alt="{ <img class="show-asset-lite" src="/media/{{fileInfo.fileName}}" alt="{{fileInfo.fileName}}"/>
{{/ifConditional}} {{/ifConditional}}
</a> </a>
</div> </div>