Open graph #132
3 changed files with 31 additions and 10 deletions
BIN
public/assets/img/content-freedom-large.png
Normal file
BIN
public/assets/img/content-freedom-large.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
40
speech.js
40
speech.js
|
@ -49,15 +49,35 @@ const hbs = expressHandlebars.create({
|
|||
);
|
||||
},
|
||||
addOpenGraph (title, url, type, source, mimeType) {
|
||||
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: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}" />`
|
||||
);
|
||||
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" />
|
||||
<meta property="author" content="Spee.ch" />
|
||||
<meta property="article:author" content="Spee.ch" />`
|
||||
);
|
||||
} else if (type === 'video') {
|
||||
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="https://spee.ch/assets/img/content-freedom-large.png" />
|
||||
<meta property="og:image:type" content="image/png" />
|
||||
<meta property="og:image:width" content="600" />
|
||||
<meta property="og:image:height" content="315" />
|
||||
<meta property="og:type" content="video" />
|
||||
<meta property="og:video" content="${source}" />
|
||||
<meta property="og:video:type" content="${mimeType}" />`
|
||||
);
|
||||
}
|
||||
},
|
||||
addTwitterCard (assetType, source) {
|
||||
if (assetType === 'image') {
|
||||
|
@ -71,7 +91,7 @@ const hbs = expressHandlebars.create({
|
|||
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:image" content="https://spee.ch/assets/img/content-freedom-large.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" />
|
||||
|
|
|
@ -7,6 +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">
|
||||
<meta property="fb:app_id" content="1371961932852223">
|
||||
{{{addTwitterCard openGraphInfo.type openGraphInfo.source}}}
|
||||
{{{addOpenGraph fileInfo.name openGraphInfo.showUrl openGraphInfo.type openGraphInfo.source fileInfo.fileType }}}
|
||||
</head>
|
||||
|
|
Loading…
Reference in a new issue