added gif case
This commit is contained in:
parent
e8d855f0cd
commit
9015c186c9
3 changed files with 29 additions and 18 deletions
41
speech.js
41
speech.js
|
@ -48,20 +48,8 @@ const hbs = expressHandlebars.create({
|
|||
</script>`
|
||||
);
|
||||
},
|
||||
addOpenGraph (title, url, type, source, mimeType) {
|
||||
if (type === 'image') {
|
||||
return new Handlebars.SafeString(
|
||||
`<meta property="og:title" content="${title}"/>
|
||||
<meta property="og:url" content="${url}" />
|
||||
<meta property="og:site_name" content="Spee.ch" />
|
||||
<meta property="og:description" content="Spee.ch: open-source, decentralized content hosting." />
|
||||
<meta property="og:image" content="${source}" />
|
||||
<meta property="og:image:type" content="${mimeType}" />
|
||||
<meta property="og:image:width" content="600" />
|
||||
<meta property="og:image:height" content="315" />
|
||||
<meta property="og:type" content="article" />`
|
||||
);
|
||||
} else if (type === 'video') {
|
||||
addOpenGraph (title, url, source, mimeType) {
|
||||
if (mimeType === 'video/mp4') {
|
||||
return new Handlebars.SafeString(
|
||||
`<meta property="og:title" content="${title}"/>
|
||||
<meta property="og:url" content="${url}" />
|
||||
|
@ -73,8 +61,33 @@ const hbs = expressHandlebars.create({
|
|||
<meta property="og:image:height" content="315" />
|
||||
<meta property="og:type" content="video" />
|
||||
<meta property="og:video" content="${source}" />
|
||||
<meta property="og:video:secure_url" content="${source}" />
|
||||
<meta property="og:video:type" content="${mimeType}" />`
|
||||
);
|
||||
} else if (mimeType === 'image/gif') {
|
||||
return new Handlebars.SafeString(
|
||||
`<meta property="og:title" content="${title}"/>
|
||||
<meta property="og:url" content="${url}" />
|
||||
<meta property="og:site_name" content="Spee.ch" />
|
||||
<meta property="og:description" content="Spee.ch: open-source, decentralized content hosting." />
|
||||
<meta property="og:image" content="${source}" />
|
||||
<meta property="og:image:type" content="${mimeType}" />
|
||||
<meta property="og:image:width" content="600" />
|
||||
<meta property="og:image:height" content="315" />
|
||||
<meta property="og:type" content="video.other" />`
|
||||
);
|
||||
} else {
|
||||
return new Handlebars.SafeString(
|
||||
`<meta property="og:title" content="${title}"/>
|
||||
<meta property="og:url" content="${url}" />
|
||||
<meta property="og:site_name" content="Spee.ch" />
|
||||
<meta property="og:description" content="Spee.ch: open-source, decentralized content hosting." />
|
||||
<meta property="og:image" content="${source}" />
|
||||
<meta property="og:image:type" content="${mimeType}" />
|
||||
<meta property="og:image:width" content="600" />
|
||||
<meta property="og:image:height" content="315" />
|
||||
<meta property="og:type" content="article" />`
|
||||
);
|
||||
}
|
||||
},
|
||||
addTwitterCard (assetType, source) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
|
||||
<meta property="fb:app_id" content="1371961932852223">
|
||||
{{{addTwitterCard openGraphInfo.type openGraphInfo.source}}}
|
||||
{{{addOpenGraph fileInfo.name openGraphInfo.showUrl openGraphInfo.type openGraphInfo.source fileInfo.fileType }}}
|
||||
{{{addOpenGraph fileInfo.name openGraphInfo.showUrl openGraphInfo.source fileInfo.fileType }}}
|
||||
</head>
|
||||
<body>
|
||||
{{{ body }}}
|
||||
|
|
|
@ -6,10 +6,8 @@
|
|||
{{!--fallback--}}
|
||||
Your browser does not support the <code>video</code> element.
|
||||
</video>
|
||||
{{addOpenGraph fileInfo.name links.showUrl 'video' links.source fileInfo.fileType }}
|
||||
{{else}}
|
||||
<img class="show-asset-lite" src="/media/{{fileInfo.fileName}}" alt="{{fileInfo.fileName}}"/>
|
||||
{{addOpenGraph fileInfo.name links.showUrl 'image' links.source fileInfo.fileType }}
|
||||
<img class="show-asset-lite" src="/media/{{fileInfo.fileName}}" alt="{
|
||||
{{/ifConditional}}
|
||||
</a>
|
||||
</div>
|
Loading…
Reference in a new issue