|
|
|
@ -12,6 +12,7 @@ class OpenGraph {
|
|
|
|
|
size;
|
|
|
|
|
|
|
|
|
|
title = '';
|
|
|
|
|
description = '';
|
|
|
|
|
author = '';
|
|
|
|
|
color = '';
|
|
|
|
|
showSize = false;
|
|
|
|
@ -31,6 +32,11 @@ class OpenGraph {
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setDescription(description) {
|
|
|
|
|
this.description = description;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setAuthor(author) {
|
|
|
|
|
this.author = author;
|
|
|
|
|
return this;
|
|
|
|
@ -60,12 +66,11 @@ class OpenGraph {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
view.title = (this.title.length != 0) ? `<meta property="og:title" content="${this.title}">` : '';
|
|
|
|
|
view.description = (this.description.length != 0) ? `<meta property="og:description" content="${this.description}">` : '';
|
|
|
|
|
view.site = (this.author.length != 0) ? `<meta property="og:site_name" content="${this.author}">` : '';
|
|
|
|
|
view.color = (this.color.length != 0) ? `<meta name="theme-color" content="${this.color}">` : '';
|
|
|
|
|
view.card = !this.type.includes('video') ? `<meta name="twitter:card" content="summary_large_image">` : '';
|
|
|
|
|
|
|
|
|
|
//todo: og:description
|
|
|
|
|
|
|
|
|
|
return Mustache.render(html, view);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -77,6 +82,7 @@ const html = `
|
|
|
|
|
<meta property="og:type" content="{{{ogtype}}}">
|
|
|
|
|
<meta property="og:{{{type}}}" content="{{{http}}}{{{domain}}}/{{{resourceId}}}{{{ext}}}">
|
|
|
|
|
{{{title}}}
|
|
|
|
|
{{{description}}}
|
|
|
|
|
{{{site}}}
|
|
|
|
|
{{{color}}}
|
|
|
|
|
{{{card}}}
|
|
|
|
|