added thumbnail to meta tags
This commit is contained in:
parent
aa7f6d567c
commit
bd2dd78200
4 changed files with 11 additions and 5 deletions
|
@ -192,6 +192,12 @@ module.exports = {
|
|||
return db.resolveClaim(fileInfo.name, fileInfo.claimId);
|
||||
})
|
||||
.then(resolveResult => {
|
||||
logger.debug(resolveResult);
|
||||
if (!resolveResult.thumbnail || resolveResult.thumbnail === '') {
|
||||
fileInfo['thumbnail'] = 'https://spee.ch/assets/img/content-freedom-large.png';
|
||||
} else {
|
||||
fileInfo['thumbnail'] = resolveResult.thumbnail;
|
||||
}
|
||||
fileInfo['title'] = resolveResult.title;
|
||||
fileInfo['description'] = resolveResult.description;
|
||||
showFile(fileInfo, res);
|
||||
|
|
|
@ -226,7 +226,7 @@ db['getAllFreeClaims'] = (name) => {
|
|||
db['resolveClaim'] = (name, claimId) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
db
|
||||
.sequelize.query(`SELECT name, claimId, outpoint, height, address, title, description FROM Claim WHERE name = '${name}' AND claimId = '${claimId}'`, { type: db.sequelize.QueryTypes.SELECT })
|
||||
.sequelize.query(`SELECT name, claimId, outpoint, height, address, title, description, thumbnail FROM Claim WHERE name = '${name}' AND claimId = '${claimId}'`, { type: db.sequelize.QueryTypes.SELECT })
|
||||
.then(result => {
|
||||
switch (result.length) {
|
||||
case 0:
|
||||
|
|
|
@ -48,14 +48,14 @@ const hbs = expressHandlebars.create({
|
|||
</script>`
|
||||
);
|
||||
},
|
||||
addOpenGraph (title, mimeType, showUrl, source, description) {
|
||||
addOpenGraph (title, mimeType, showUrl, source, description, thumbnail) {
|
||||
let basicTags = `<meta property="og:title" content="${title}">
|
||||
<meta property="og:url" content="${showUrl}" >
|
||||
<meta property="og:site_name" content="Spee.ch" >
|
||||
<meta property="og:description" content="${description}">`;
|
||||
if (mimeType === 'video/mp4') {
|
||||
return new Handlebars.SafeString(
|
||||
`${basicTags} <meta property="og:image" content="https://spee.ch/assets/img/content-freedom-large.png" >
|
||||
`${basicTags} <meta property="og:image" content="${thumbnail}" >
|
||||
<meta property="og:image:type" content="image/png" >
|
||||
<meta property="og:image:width" content="600" >
|
||||
<meta property="og:image:height" content="315" >
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
|
||||
<meta property="fb:app_id" content="1371961932852223">
|
||||
{{#unless fileInfo.nsfw}}
|
||||
{{{addTwitterCard fileInfo.fileType openGraphInfo.source openGraphInfo.embedUrl openGraphInfo.directFileUrl}}}
|
||||
{{{addOpenGraph fileInfo.title fileInfo.fileType openGraphInfo.showUrl openGraphInfo.source fileInfo.description}}}
|
||||
{{{addTwitterCard fileInfo.fileType openGraphInfo.source openGraphInfo.embedUrl openGraphInfo.directFileUrl}}}
|
||||
{{{addOpenGraph fileInfo.title fileInfo.fileType openGraphInfo.showUrl openGraphInfo.source fileInfo.description fileInfo.thumbnail}}}
|
||||
{{/unless}}
|
||||
<!-- google analytics -->
|
||||
{{ googleAnalytics }}
|
||||
|
|
Loading…
Reference in a new issue